diff options
Diffstat (limited to 'deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules')
3 files changed, 36 insertions, 55 deletions
diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/index.js b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/index.js index 72297501f9..6a522b16b3 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/index.js +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/index.js @@ -6,7 +6,6 @@ var s = 1000; var m = s * 60; var h = m * 60; var d = h * 24; -var w = d * 7; var y = d * 365.25; /** @@ -50,7 +49,7 @@ function parse(str) { if (str.length > 100) { return; } - var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( str ); if (!match) { @@ -65,10 +64,6 @@ function parse(str) { case 'yr': case 'y': return n * y; - case 'weeks': - case 'week': - case 'w': - return n * w; case 'days': case 'day': case 'd': @@ -111,17 +106,16 @@ function parse(str) { */ function fmtShort(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { + if (ms >= d) { return Math.round(ms / d) + 'd'; } - if (msAbs >= h) { + if (ms >= h) { return Math.round(ms / h) + 'h'; } - if (msAbs >= m) { + if (ms >= m) { return Math.round(ms / m) + 'm'; } - if (msAbs >= s) { + if (ms >= s) { return Math.round(ms / s) + 's'; } return ms + 'ms'; @@ -136,27 +130,23 @@ function fmtShort(ms) { */ function fmtLong(ms) { - var msAbs = Math.abs(ms); - if (msAbs >= d) { - return plural(ms, msAbs, d, 'day'); - } - if (msAbs >= h) { - return plural(ms, msAbs, h, 'hour'); - } - if (msAbs >= m) { - return plural(ms, msAbs, m, 'minute'); - } - if (msAbs >= s) { - return plural(ms, msAbs, s, 'second'); - } - return ms + ' ms'; + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms'; } /** * Pluralization helper. */ -function plural(ms, msAbs, n, name) { - var isPlural = msAbs >= n * 1.5; - return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +function plural(ms, n, name) { + if (ms < n) { + return; + } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name; + } + return Math.ceil(ms / n) + ' ' + name + 's'; } diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/package.json b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/package.json index 620608a335..298ecd3f2d 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/package.json +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/package.json @@ -1,8 +1,8 @@ { "_from": "ms@^2.0.0", - "_id": "ms@2.1.1", + "_id": "ms@2.0.0", "_inBundle": false, - "_integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", + "_integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "_location": "/npm-profile/make-fetch-happen/agentkeepalive/humanize-ms/ms", "_phantomChildren": {}, "_requested": { @@ -18,8 +18,8 @@ "_requiredBy": [ "/npm-profile/make-fetch-happen/agentkeepalive/humanize-ms" ], - "_resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "_shasum": "30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a", + "_resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "_shasum": "5608aeadfc00be6c2901df5f9861788de0d597c8", "_spec": "ms@^2.0.0", "_where": "/Users/rebecca/code/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms", "bugs": { @@ -27,13 +27,13 @@ }, "bundleDependencies": false, "deprecated": false, - "description": "Tiny millisecond conversion utility", + "description": "Tiny milisecond conversion utility", "devDependencies": { - "eslint": "4.12.1", + "eslint": "3.19.0", "expect.js": "0.3.1", - "husky": "0.14.3", - "lint-staged": "5.0.0", - "mocha": "4.0.1" + "husky": "0.13.3", + "lint-staged": "3.4.1", + "mocha": "3.4.1" }, "eslintConfig": { "extends": "eslint:recommended", @@ -65,5 +65,5 @@ "precommit": "lint-staged", "test": "mocha tests.js" }, - "version": "2.1.1" + "version": "2.0.0" } diff --git a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/readme.md b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/readme.md index bb767293ac..84a9974ccc 100644 --- a/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/readme.md +++ b/deps/npm/node_modules/npm-profile/node_modules/make-fetch-happen/node_modules/agentkeepalive/node_modules/humanize-ms/node_modules/ms/readme.md @@ -17,44 +17,35 @@ ms('1m') // 60000 ms('5s') // 5000 ms('1y') // 31557600000 ms('100') // 100 -ms('-3 days') // -259200000 -ms('-1h') // -3600000 -ms('-200') // -200 ``` -### Convert from Milliseconds +### Convert from milliseconds ```js ms(60000) // "1m" ms(2 * 60000) // "2m" -ms(-3 * 60000) // "-3m" ms(ms('10 hours')) // "10h" ``` -### Time Format Written-Out +### Time format written-out ```js ms(60000, { long: true }) // "1 minute" ms(2 * 60000, { long: true }) // "2 minutes" -ms(-3 * 60000, { long: true }) // "-3 minutes" ms(ms('10 hours'), { long: true }) // "10 hours" ``` ## Features -- Works both in [Node.js](https://nodejs.org) and in the browser -- If a number is supplied to `ms`, a string with a unit is returned -- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) -- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned +- Works both in [node](https://nodejs.org) and in the browser. +- If a number is supplied to `ms`, a string with a unit is returned. +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`). +- If you pass a string with a number and a valid unit, the number of equivalent ms is returned. -## Related Packages - -- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. - -## Caught a Bug? +## Caught a bug? 1. [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 2. Link the package to the global module directory: `npm link` -3. 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! +3. 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! As always, you can run the tests using: `npm test` |