@prsm/ms
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

ms

NPM version

Confusingly, not just for converting milliseconds.

import ms from "@prsm/ms";

ms(100); // 100
ms("100"); // 100

ms("10s"); // 10_000
ms("10sec"); // 10_000
ms("10secs"); // 10_000
ms("10second"); // 10_000
ms("10,000,000seconds"); // 10_000_000_000

ms("0h"); // 0
ms("10.9ms"); // 11
ms("10.9ms", { round: false }); // 10.9

ms("1000.9ms", { round: false, unit: "s" }); // 1.0009
ms("1000.9ms", { unit: "s" }); // 1

// All supported unit aliases:
// ms, msec, msecs, millisec, milliseconds
// s, sec, secs, second, seconds
// m, min, mins, minute, minutes
// h, hr, hrs, hour, hours
// d, day, days
// w, wk, wks, week, weeks

Readme

Keywords

none

Package Sidebar

Install

npm i @prsm/ms

Weekly Downloads

1

Version

1.0.1

License

Apache-2.0

Unpacked Size

99.3 kB

Total Files

10

Last publish

Collaborators

  • nvmsy