mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-27 22:59:51 -05:00
trim intervals
This commit is contained in:
parent
48825a2e46
commit
bb9612441c
2 changed files with 2 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue