Added error checking for when an invalid string is input.
This commit is contained in:
parent
9797b474af
commit
e0be5577a7
2
index.js
2
index.js
@ -63,6 +63,8 @@ function parseTimestring (string, returnUnit, opts) {
|
|||||||
|
|
||||||
totalSeconds += getSeconds(value, unit, unitValues)
|
totalSeconds += getSeconds(value, unit, unitValues)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
throw new Error(`The string [${string}] is invalid for timestring`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (returnUnit) {
|
if (returnUnit) {
|
||||||
|
Loading…
Reference in New Issue
Block a user