市场夺宝奇兵
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
671 B

  1. # parse-ms
  2. > Parse milliseconds into an object
  3. ## Install
  4. ```sh
  5. npm install parse-ms
  6. ```
  7. ## Usage
  8. ```js
  9. import parseMilliseconds from 'parse-ms';
  10. parseMilliseconds(1337000001);
  11. /*
  12. {
  13. days: 15,
  14. hours: 11,
  15. minutes: 23,
  16. seconds: 20,
  17. milliseconds: 1,
  18. microseconds: 0,
  19. nanoseconds: 0
  20. }
  21. */
  22. parseMilliseconds(1337000001n);
  23. /*
  24. {
  25. days: 15n,
  26. hours: 11n,
  27. minutes: 23n,
  28. seconds: 20n,
  29. milliseconds: 1n,
  30. microseconds: 0n,
  31. nanoseconds: 0n
  32. }
  33. */
  34. ```
  35. ## Related
  36. - [to-milliseconds](https://github.com/sindresorhus/to-milliseconds) - The inverse of this module
  37. - [pretty-ms](https://github.com/sindresorhus/pretty-ms) - Convert milliseconds to a human readable string