corrade-nucleus-nucleons
/compass/005_compass/compass/node_modules/ms/History.md |
@@ -0,0 +1,66 @@ |
|
0.7.1 / 2015-04-20 |
================== |
|
* prevent extraordinary long inputs (@evilpacket) |
* Fixed broken readme link |
|
0.7.0 / 2014-11-24 |
================== |
|
* add time abbreviations, updated tests and readme for the new units |
* fix example in the readme. |
* add LICENSE file |
|
0.6.2 / 2013-12-05 |
================== |
|
* Adding repository section to package.json to suppress warning from NPM. |
|
0.6.1 / 2013-05-10 |
================== |
|
* fix singularization [visionmedia] |
|
0.6.0 / 2013-03-15 |
================== |
|
* fix minutes |
|
0.5.1 / 2013-02-24 |
================== |
|
* add component namespace |
|
0.5.0 / 2012-11-09 |
================== |
|
* add short formatting as default and .long option |
* add .license property to component.json |
* add version to component.json |
|
0.4.0 / 2012-10-22 |
================== |
|
* add rounding to fix crazy decimals |
|
0.3.0 / 2012-09-07 |
================== |
|
* fix `ms(<String>)` [visionmedia] |
|
0.2.0 / 2012-09-03 |
================== |
|
* add component.json [visionmedia] |
* add days support [visionmedia] |
* add hours support [visionmedia] |
* add minutes support [visionmedia] |
* add seconds support [visionmedia] |
* add ms string support [visionmedia] |
* refactor tests to facilitate ms(number) [visionmedia] |
|
0.1.0 / 2012-03-07 |
================== |
|
* Initial release |
/compass/005_compass/compass/node_modules/ms/LICENSE |
@@ -0,0 +1,20 @@ |
(The MIT License) |
|
Copyright (c) 2014 Guillermo Rauch <rauchg@gmail.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. |
/compass/005_compass/compass/node_modules/ms/README.md |
@@ -0,0 +1,35 @@ |
# ms.js: miliseconds conversion utility |
|
```js |
ms('2 days') // 172800000 |
ms('1d') // 86400000 |
ms('10h') // 36000000 |
ms('2.5 hrs') // 9000000 |
ms('2h') // 7200000 |
ms('1m') // 60000 |
ms('5s') // 5000 |
ms('100') // 100 |
``` |
|
```js |
ms(60000) // "1m" |
ms(2 * 60000) // "2m" |
ms(ms('10 hours')) // "10h" |
``` |
|
```js |
ms(60000, { long: true }) // "1 minute" |
ms(2 * 60000, { long: true }) // "2 minutes" |
ms(ms('10 hours'), { long: true }) // "10 hours" |
``` |
|
- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). |
- 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. |
|
## License |
|
MIT |
/compass/005_compass/compass/node_modules/ms/index.js |
@@ -0,0 +1,125 @@ |
/** |
* Helpers. |
*/ |
|
var s = 1000; |
var m = s * 60; |
var h = m * 60; |
var d = h * 24; |
var y = d * 365.25; |
|
/** |
* Parse or format the given `val`. |
* |
* Options: |
* |
* - `long` verbose formatting [false] |
* |
* @param {String|Number} val |
* @param {Object} options |
* @return {String|Number} |
* @api public |
*/ |
|
module.exports = function(val, options){ |
options = options || {}; |
if ('string' == typeof val) return parse(val); |
return options.long |
? long(val) |
: short(val); |
}; |
|
/** |
* Parse the given `str` and return milliseconds. |
* |
* @param {String} str |
* @return {Number} |
* @api private |
*/ |
|
function parse(str) { |
str = '' + str; |
if (str.length > 10000) return; |
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) return; |
var n = parseFloat(match[1]); |
var type = (match[2] || 'ms').toLowerCase(); |
switch (type) { |
case 'years': |
case 'year': |
case 'yrs': |
case 'yr': |
case 'y': |
return n * y; |
case 'days': |
case 'day': |
case 'd': |
return n * d; |
case 'hours': |
case 'hour': |
case 'hrs': |
case 'hr': |
case 'h': |
return n * h; |
case 'minutes': |
case 'minute': |
case 'mins': |
case 'min': |
case 'm': |
return n * m; |
case 'seconds': |
case 'second': |
case 'secs': |
case 'sec': |
case 's': |
return n * s; |
case 'milliseconds': |
case 'millisecond': |
case 'msecs': |
case 'msec': |
case 'ms': |
return n; |
} |
} |
|
/** |
* Short format for `ms`. |
* |
* @param {Number} ms |
* @return {String} |
* @api private |
*/ |
|
function short(ms) { |
if (ms >= d) return Math.round(ms / d) + 'd'; |
if (ms >= h) return Math.round(ms / h) + 'h'; |
if (ms >= m) return Math.round(ms / m) + 'm'; |
if (ms >= s) return Math.round(ms / s) + 's'; |
return ms + 'ms'; |
} |
|
/** |
* Long format for `ms`. |
* |
* @param {Number} ms |
* @return {String} |
* @api private |
*/ |
|
function long(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, n, name) { |
if (ms < n) return; |
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; |
return Math.ceil(ms / n) + ' ' + name + 's'; |
} |
/compass/005_compass/compass/node_modules/ms/package.json |
@@ -0,0 +1,49 @@ |
{ |
"_from": "ms@0.7.1", |
"_id": "ms@0.7.1", |
"_inBundle": false, |
"_integrity": "sha1-nNE8A62/8ltl7/3nzoZO6VIBcJg=", |
"_location": "/ms", |
"_phantomChildren": {}, |
"_requested": { |
"type": "version", |
"registry": true, |
"raw": "ms@0.7.1", |
"name": "ms", |
"escapedName": "ms", |
"rawSpec": "0.7.1", |
"saveSpec": null, |
"fetchSpec": "0.7.1" |
}, |
"_requiredBy": [ |
"/debug" |
], |
"_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", |
"_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", |
"_spec": "ms@0.7.1", |
"_where": "/Users/horia.corcalciuc/Documents/Development/corrade-nucleus-nucleons/compass/005_compass/compass/node_modules/debug", |
"bugs": { |
"url": "https://github.com/guille/ms.js/issues" |
}, |
"bundleDependencies": false, |
"component": { |
"scripts": { |
"ms/index.js": "index.js" |
} |
}, |
"deprecated": false, |
"description": "Tiny ms conversion utility", |
"devDependencies": { |
"expect.js": "*", |
"mocha": "*", |
"serve": "*" |
}, |
"homepage": "https://github.com/guille/ms.js#readme", |
"main": "./index", |
"name": "ms", |
"repository": { |
"type": "git", |
"url": "git://github.com/guille/ms.js.git" |
}, |
"version": "0.7.1" |
} |