Ms
ms a Tiny milisecond conversion utility, that does the below:
number -> (ms) -> string with a unit is returned.
string -> (ms) -> string
string+number with a valid unit -> (ms) -> number of equivalent ms
Installing: npm install ms
Usage:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
ms
is one of those sweet tiny module that does exactly what is expected from it. The code is just 111 lines, logic is pretty simple,
the method parses the given str
and return milliseconds ;) well it also support short and long format for ms
and has a Pluralization helper too.
Below as few selected chunks from the source code:
Helpers:
1 2 3 4 5 |
|
Matcher:
1
|
|
Pluralization:
1 2 3 4 5 |
|
GIF FTW!
Special thanks to Guillermo Rauch for this wonderful module :)