jkroso / parse-duration

convert a human readable duration to ms
MIT License
243 stars 38 forks source link

Added tests and support for singular form without integer #3

Closed VictorioBerra closed 8 years ago

VictorioBerra commented 8 years ago

closes #2 closes #1

VictorioBerra commented 8 years ago

I will remove the "g" flag. As for strings without the "s" at the end: what about ms, ns, μs, s? This makes it very difficult to check in the code.

Jokero commented 8 years ago

ms, ns, μs, s are ok. I mean only strings in long form:

parse('ms') // ok, equal to 1 ms
parse('s') // ok, equal to 1 s

parse('second') // ok, equal to 1 s
parse('seconds') // this should not be equal to 1 s, because it will be very strange
jkroso commented 8 years ago

I don't see the value in this change. BTW you can do parse['ms'], parse['second'] if you know you are receiving that kind of input