diff options
Diffstat (limited to 'node_modules/parse-ms')
-rw-r--r-- | node_modules/parse-ms/index.js | 16 | ||||
-rw-r--r-- | node_modules/parse-ms/license | 21 | ||||
-rw-r--r-- | node_modules/parse-ms/package.json | 34 | ||||
-rw-r--r-- | node_modules/parse-ms/readme.md | 23 |
4 files changed, 94 insertions, 0 deletions
diff --git a/node_modules/parse-ms/index.js b/node_modules/parse-ms/index.js new file mode 100644 index 000000000..838cb2ef0 --- /dev/null +++ b/node_modules/parse-ms/index.js @@ -0,0 +1,16 @@ +'use strict'; +module.exports = function (ms) { + if (typeof ms !== 'number') { + throw new TypeError('Expected a number'); + } + + var roundTowardZero = ms > 0 ? Math.floor : Math.ceil; + + return { + days: roundTowardZero(ms / 86400000), + hours: roundTowardZero(ms / 3600000) % 24, + minutes: roundTowardZero(ms / 60000) % 60, + seconds: roundTowardZero(ms / 1000) % 60, + milliseconds: roundTowardZero(ms) % 1000 + }; +}; diff --git a/node_modules/parse-ms/license b/node_modules/parse-ms/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/parse-ms/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/parse-ms/package.json b/node_modules/parse-ms/package.json new file mode 100644 index 000000000..ce7bc7a42 --- /dev/null +++ b/node_modules/parse-ms/package.json @@ -0,0 +1,34 @@ +{ + "name": "parse-ms", + "version": "1.0.1", + "description": "Parse milliseconds into an object", + "license": "MIT", + "repository": "sindresorhus/parse-ms", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "browser", + "parse", + "time", + "ms", + "milliseconds", + "duration", + "period", + "range" + ], + "devDependencies": { + "mocha": "*" + } +} diff --git a/node_modules/parse-ms/readme.md b/node_modules/parse-ms/readme.md new file mode 100644 index 000000000..6e907d32e --- /dev/null +++ b/node_modules/parse-ms/readme.md @@ -0,0 +1,23 @@ +# parse-ms [](https://travis-ci.org/sindresorhus/parse-ms) + +> Parse milliseconds into an object + + +## Install + +```sh +$ npm install --save parse-ms +``` + + +## Usage + +```js +parseMs(1337000001); +//=> { days: 15, hours: 11, minutes: 23, seconds: 20, milliseconds: 1 } +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) |