opusdev/vector-similarity-api
1
1# ms2 3[](https://travis-ci.org/zeit/ms)4[](https://zeit.chat/)5 6Use this package to easily convert various time formats to milliseconds.7 8## Examples9 10```js11ms('2 days') // 17280000012ms('1d') // 8640000013ms('10h') // 3600000014ms('2.5 hrs') // 900000015ms('2h') // 720000016ms('1m') // 6000017ms('5s') // 500018ms('1y') // 3155760000019ms('100') // 10020```21 22### Convert from milliseconds23 24```js25ms(60000) // "1m"26ms(2 * 60000) // "2m"27ms(ms('10 hours')) // "10h"28```29 30### Time format written-out31 32```js33ms(60000, { long: true }) // "1 minute"34ms(2 * 60000, { long: true }) // "2 minutes"35ms(ms('10 hours'), { long: true }) // "10 hours"36```37 38## Features39 40- Works both in [node](https://nodejs.org) and in the browser.41- If a number is supplied to `ms`, a string with a unit is returned.42- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`).43- If you pass a string with a number and a valid unit, the number of equivalent ms is returned.44 45## Caught a bug?46 471. [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 device482. Link the package to the global module directory: `npm link`493. 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 will now use your clone of ms!50 51As always, you can run the tests using: `npm test`52 