source: imaps-frontend/node_modules/ms/readme.md@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 1.8 KB
Line 
1# ms
2
3![CI](https://github.com/vercel/ms/workflows/CI/badge.svg)
4
5Use this package to easily convert various time formats to milliseconds.
6
7## Examples
8
9```js
10ms('2 days') // 172800000
11ms('1d') // 86400000
12ms('10h') // 36000000
13ms('2.5 hrs') // 9000000
14ms('2h') // 7200000
15ms('1m') // 60000
16ms('5s') // 5000
17ms('1y') // 31557600000
18ms('100') // 100
19ms('-3 days') // -259200000
20ms('-1h') // -3600000
21ms('-200') // -200
22```
23
24### Convert from Milliseconds
25
26```js
27ms(60000) // "1m"
28ms(2 * 60000) // "2m"
29ms(-3 * 60000) // "-3m"
30ms(ms('10 hours')) // "10h"
31```
32
33### Time Format Written-Out
34
35```js
36ms(60000, { long: true }) // "1 minute"
37ms(2 * 60000, { long: true }) // "2 minutes"
38ms(-3 * 60000, { long: true }) // "-3 minutes"
39ms(ms('10 hours'), { long: true }) // "10 hours"
40```
41
42## Features
43
44- Works both in [Node.js](https://nodejs.org) and in the browser
45- If a number is supplied to `ms`, a string with a unit is returned
46- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
47- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
48
49## Related Packages
50
51- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
52
53## Caught a Bug?
54
551. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
562. Link the package to the global module directory: `npm link`
573. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
58
59As always, you can run the tests using: `npm test`
Note: See TracBrowser for help on using the repository browser.