diff --git a/lib/config.js b/lib/config.js index ed257b8e2..e022732d7 100644 --- a/lib/config.js +++ b/lib/config.js @@ -169,6 +169,7 @@ module.exports.parse_interval = function(interval) { var result = 0 var last_suffix = Infinity interval.split(/\s+/).forEach(function(x) { + if (!x) return var m = x.match(/^((0|[1-9][0-9]*)(\.[0-9]+)?)(ms|s|m|h|d|w|M|y|)$/) if (!m || parse_interval_table[m[4]] >= last_suffix diff --git a/test/unit/parse_interval.js b/test/unit/parse_interval.js index b0a0c2dd5..4b35a2942 100644 --- a/test/unit/parse_interval.js +++ b/test/unit/parse_interval.js @@ -29,5 +29,6 @@ describe('Parse interval', function() { add_test('1m 1m', null) add_test('1m 1y', null) add_test('1y 1M 1w 1d 1h 1m 1s 1ms', 34822861001) + add_test(' 5s 25ms ', 5025) })