Closed prairir closed 3 years ago
the current type system is not as flexible as parsing.
doing
var parseDuration = require("parse-duration@0.4.0") console.log(parseDuration('10 seconds', 'seconds'))
will print NaN but doing
NaN
var parseDuration = require("parse-duration@0.4.0") console.log(parseDuration('10 seconds', 's'))
will print 10, the correct answer.
10
I believe that the unit types should be as flexible as the parsing types as not having it that way can lead to errors and weirdness.
Fixed in v1.0
the current type system is not as flexible as parsing.
doing
will print
NaN
but doingwill print
10
, the correct answer.I believe that the unit types should be as flexible as the parsing types as not having it that way can lead to errors and weirdness.