From e0be5577a74a92fa13d34b463dd9bf4e3a42948f Mon Sep 17 00:00:00 2001 From: Ashton Cummings Date: Thu, 20 Sep 2018 09:26:31 -0500 Subject: [PATCH] Added error checking for when an invalid string is input. --- index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/index.js b/index.js index b21f71e..194bff7 100644 --- a/index.js +++ b/index.js @@ -63,6 +63,8 @@ function parseTimestring (string, returnUnit, opts) { totalSeconds += getSeconds(value, unit, unitValues) }) + } else { + throw new Error(`The string [${string}] is invalid for timestring`) } if (returnUnit) {