This commit is contained in:
tatianamac
2019-11-26 14:50:43 -08:00
parent 8a55660ed0
commit 6d5445ecc5
13894 changed files with 2233957 additions and 0 deletions

51
node_modules/pretty-ms/cli.js generated vendored Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var prettyMs = require('./index');
var input = process.argv[2];
function stdin(cb) {
var ret = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) { ret += data });
process.stdin.on('end', function () { cb(ret) }).resume();
}
function help() {
console.log(pkg.description);
console.log('');
console.log('Usage');
console.log(' $ pretty-ms <milliseconds> [--compact]');
console.log(' $ echo <milliseconds> | pretty-ms');
console.log('');
console.log('Example');
console.log(' $ pretty-ms 1337');
console.log(' 1s 337ms');
}
function init(data) {
console.log(prettyMs(Number(data), {
compact: process.argv.indexOf('--compact') !== -1
}));
}
if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) {
help();
return;
}
if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;
}
if (process.stdin.isTTY) {
if (!input) {
help();
return;
}
init(input);
} else {
stdin(init);
}

38
node_modules/pretty-ms/index.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
'use strict';
var parseMs = require('parse-ms');
function add(ret, val, postfix) {
if (val > 0) {
ret.push(val + postfix);
}
return ret;
}
module.exports = function (ms, opts) {
if (typeof ms !== 'number') {
throw new TypeError('Expected a number');
}
if (ms < 1000) {
return Math.ceil(ms) + 'ms';
}
opts = opts || {};
var ret = [];
var parsed = parseMs(ms);
ret = add(ret, parsed.days, 'd');
ret = add(ret, parsed.hours, 'h');
ret = add(ret, parsed.minutes, 'm');
if (opts.compact) {
ret = add(ret, parsed.seconds, 's');
return '~' + ret[0];
}
ret = add(ret, (ms / 1000 % 60).toFixed(1).replace(/\.0$/, ''), 's');
return ret.join(' ');
};

83
node_modules/pretty-ms/package.json generated vendored Normal file
View File

@@ -0,0 +1,83 @@
{
"_args": [
[
"pretty-ms@0.2.2",
"/Users/tatiana/selfdefined"
]
],
"_from": "pretty-ms@0.2.2",
"_id": "pretty-ms@0.2.2",
"_inBundle": false,
"_integrity": "sha1-2oeaaC/zOjcBEEbxPWJ/Z8c7hPY=",
"_location": "/pretty-ms",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "pretty-ms@0.2.2",
"name": "pretty-ms",
"escapedName": "pretty-ms",
"rawSpec": "0.2.2",
"saveSpec": null,
"fetchSpec": "0.2.2"
},
"_requiredBy": [
"/time-require"
],
"_resolved": "https://registry.npmjs.org/pretty-ms/-/pretty-ms-0.2.2.tgz",
"_spec": "0.2.2",
"_where": "/Users/tatiana/selfdefined",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bin": {
"pretty-ms": "cli.js"
},
"bugs": {
"url": "https://github.com/sindresorhus/pretty-ms/issues"
},
"dependencies": {
"parse-ms": "^0.1.0"
},
"description": "Convert milliseconds to a human readable string: 1337000000 ➔ 15d 11h 23m 20s",
"devDependencies": {
"browserify": "^3.0.0",
"mocha": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js",
"cli.js"
],
"homepage": "https://github.com/sindresorhus/pretty-ms#readme",
"keywords": [
"cli",
"bin",
"browser",
"pretty",
"human",
"humanized",
"readable",
"time",
"ms",
"milliseconds",
"duration",
"period",
"range"
],
"license": "MIT",
"name": "pretty-ms",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/pretty-ms.git"
},
"scripts": {
"browser": "browserify -s $npm_package_name -o browser.js .",
"test": "mocha"
},
"version": "0.2.2"
}

80
node_modules/pretty-ms/readme.md generated vendored Normal file
View File

@@ -0,0 +1,80 @@
# pretty-ms [![Build Status](https://travis-ci.org/sindresorhus/pretty-ms.svg?branch=master)](https://travis-ci.org/sindresorhus/pretty-ms)
> Convert milliseconds to a human readable string: `1337000000` ➔ `15d 11h 23m 20s`
## Install
```sh
$ npm install --save pretty-ms
```
```sh
$ bower install --save pretty-ms
```
```sh
$ component install sindresorhus/pretty-ms
```
## Usage
```js
prettyMs(1337000000);
//=> '15d 11h 23m 20s'
prettyMs(1337);
//=> '1.3s'
prettyMs(133);
//=> '133ms'
// compact option
prettyMs(1337, {compact: true});
//=> '~1s'
// can be useful for time durations
prettyMs(new Date(2014, 0, 1, 10, 40) - new Date(2014, 0, 1, 10, 5))
//=> '35m'
```
## API
### prettyMs(milliseconds, options)
#### milliseconds
*Required*
Type: `number`
#### options.compact
Type: `boolean`
Only show the first unit: `1h 10m``~1h`.
## CLI
```bash
$ npm install --global pretty-ms
```
```bash
$ pretty-ms --help
Usage
$ pretty-ms <milliseconds> [--compact]
$ echo <milliseconds> | pretty-ms
Example
$ pretty-ms 1337
1.3s
```
## License
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)