diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:38:50 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-28 00:40:43 +0200 |
commit | 7fff4499fd915bcea3fa93b1aa8b35f4fe7a6027 (patch) | |
tree | 6de9a1aebd150a23b7f8c273ec657a5d0a18fe3e /node_modules/time-require/node_modules | |
parent | 963b7a41feb29cc4be090a2446bdfe0c1f1bcd81 (diff) |
add linting (and some initial fixes)
Diffstat (limited to 'node_modules/time-require/node_modules')
19 files changed, 856 insertions, 0 deletions
diff --git a/node_modules/time-require/node_modules/.bin/pretty-ms b/node_modules/time-require/node_modules/.bin/pretty-ms new file mode 120000 index 000000000..e00b450ee --- /dev/null +++ b/node_modules/time-require/node_modules/.bin/pretty-ms @@ -0,0 +1 @@ +../pretty-ms/cli.js
\ No newline at end of file diff --git a/node_modules/time-require/node_modules/ansi-styles/ansi-styles.js b/node_modules/time-require/node_modules/ansi-styles/ansi-styles.js new file mode 100644 index 000000000..3da548c40 --- /dev/null +++ b/node_modules/time-require/node_modules/ansi-styles/ansi-styles.js @@ -0,0 +1,38 @@ +'use strict'; +var styles = module.exports; + +var codes = { + reset: [0, 0], + + bold: [1, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + strikethrough: [9, 29], + + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] +}; + +Object.keys(codes).forEach(function (key) { + var val = codes[key]; + var style = styles[key] = {}; + style.open = '\x1b[' + val[0] + 'm'; + style.close = '\x1b[' + val[1] + 'm'; +}); diff --git a/node_modules/time-require/node_modules/ansi-styles/package.json b/node_modules/time-require/node_modules/ansi-styles/package.json new file mode 100644 index 000000000..f0af5291d --- /dev/null +++ b/node_modules/time-require/node_modules/ansi-styles/package.json @@ -0,0 +1,52 @@ +{ + "name": "ansi-styles", + "version": "1.0.0", + "description": "ANSI escape codes for colorizing strings in the terminal", + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "homepage": "https://github.com/sindresorhus/ansi-styles", + "bugs": "https://github.com/sindresorhus/ansi-styles/issues", + "license": "MIT", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "files": [ + "ansi-styles.js" + ], + "main": "ansi-styles", + "repository": { + "type": "git", + "url": "git://github.com/sindresorhus/ansi-styles.git" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "mocha": "~1.12.0" + }, + "engines": { + "node": ">=0.8.0" + } +} diff --git a/node_modules/time-require/node_modules/ansi-styles/readme.md b/node_modules/time-require/node_modules/ansi-styles/readme.md new file mode 100644 index 000000000..4ac8cbd0a --- /dev/null +++ b/node_modules/time-require/node_modules/ansi-styles/readme.md @@ -0,0 +1,65 @@ +# ansi-styles [](http://travis-ci.org/sindresorhus/ansi-styles) + +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for colorizing strings in the terminal. + +You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. + + + + +## Install + +Install with [npm](https://npmjs.org/package/ansi-styles): `npm install --save ansi-styles` + + +## Example + +```js +var ansi = require('ansi-styles'); + +console.log(ansi.green.open + 'Hello world!' + ansi.green.close); +``` + +## API + +Each style has an `open` and `close` property. + + +## Styles + +### General + +- reset +- bold +- italic +- underline +- inverse +- strikethrough + +### Text colors + +- black +- red +- green +- yellow +- blue +- magenta +- cyan +- white +- gray + +### Background colors + +- bgBlack +- bgRed +- bgGreen +- bgYellow +- bgBlue +- bgMagenta +- bgCyan +- bgWhite + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/time-require/node_modules/chalk/index.js b/node_modules/time-require/node_modules/chalk/index.js new file mode 100644 index 000000000..a21f70223 --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/index.js @@ -0,0 +1,63 @@ +'use strict'; +var ansi = require('ansi-styles'); +var stripAnsi = require('strip-ansi'); +var hasColor = require('has-color'); +var defineProps = Object.defineProperties; +var chalk = module.exports; + +var styles = (function () { + var ret = {}; + + ansi.grey = ansi.gray; + + Object.keys(ansi).forEach(function (key) { + ret[key] = { + get: function () { + this._styles.push(key); + return this; + } + }; + }); + + return ret; +})(); + +function init() { + var ret = {}; + + Object.keys(styles).forEach(function (name) { + ret[name] = { + get: function () { + var obj = defineProps(function self() { + var str = [].slice.call(arguments).join(' '); + + if (!chalk.enabled) { + return str; + } + + return self._styles.reduce(function (str, name) { + var code = ansi[name]; + return str ? code.open + str + code.close : ''; + }, str); + }, styles); + + obj._styles = []; + + return obj[name]; + } + } + }); + + return ret; +} + +defineProps(chalk, init()); + +chalk.styles = ansi; +chalk.stripColor = stripAnsi; +chalk.supportsColor = hasColor; + +// detect mode if not set manually +if (chalk.enabled === undefined) { + chalk.enabled = chalk.supportsColor; +} diff --git a/node_modules/time-require/node_modules/chalk/node_modules/.bin/strip-ansi b/node_modules/time-require/node_modules/chalk/node_modules/.bin/strip-ansi new file mode 120000 index 000000000..f7646606c --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/node_modules/.bin/strip-ansi @@ -0,0 +1 @@ +../../../strip-ansi/cli.js
\ No newline at end of file diff --git a/node_modules/time-require/node_modules/chalk/package.json b/node_modules/time-require/node_modules/chalk/package.json new file mode 100644 index 000000000..448f75aac --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/package.json @@ -0,0 +1,50 @@ +{ + "name": "chalk", + "version": "0.4.0", + "description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.", + "license": "MIT", + "repository": "sindresorhus/chalk", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "ansi", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "has-color": "~0.1.0", + "ansi-styles": "~1.0.0", + "strip-ansi": "~0.1.0" + }, + "devDependencies": { + "mocha": "~1.x" + } +} diff --git a/node_modules/time-require/node_modules/chalk/readme.md b/node_modules/time-require/node_modules/chalk/readme.md new file mode 100644 index 000000000..46813acfc --- /dev/null +++ b/node_modules/time-require/node_modules/chalk/readme.md @@ -0,0 +1,158 @@ +# <img width="250" src="logo.png" alt="chalk"> + +> Terminal string styling done right + +[](http://travis-ci.org/sindresorhus/chalk) + +[colors.js](https://github.com/Marak/colors.js) is currently the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. + +**Chalk is a clean and focused alternative.** + + + + +## Why + +- **Doesn't extend String.prototype** +- Expressive API +- Clean and focused +- Auto-detects color support +- Actively maintained +- [Used by 150+ modules](https://npmjs.org/browse/depended/chalk) + + +## Install + +Install with [npm](https://npmjs.org/package/chalk): `npm install --save chalk` + + +## Example + +Chalk comes with an easy to use composable API where you just chain and nest the styles you want. + +```js +var chalk = require('chalk'); + +// style a string +console.log( chalk.blue('Hello world!') ); + +// combine styled and normal strings +console.log( chalk.blue('Hello'), 'World' + chalk.red('!') ); + +// compose multiple styles using the chainable API +console.log( chalk.blue.bgRed.bold('Hello world!') ); + +// nest styles +console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') ); + +// pass in multiple arguments +console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') ); +``` + +You can easily define your own themes. + +```js +var chalk = require('chalk'); +var error = chalk.bold.red; +console.log(error('Error!')); +``` + + +## API + +### chalk.`<style>[.<style>...](string, [string...])` + +Example: `chalk.red.bold.underline('Hello', 'world');` + +Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter. + +Multiple arguments will be separated by space. + +### chalk.enabled + +Color support is automatically detected, but you can override it. + +### chalk.supportsColor + +Detect whether the terminal [supports color](https://github.com/sindresorhus/has-color). + +Can be overridden by the user with the flags `--color` and `--no-color`. + +Used internally and handled for you, but exposed for convenience. + +### chalk.styles + +Exposes the styles as [ANSI escape codes](https://github.com/sindresorhus/ansi-styles). + +Generally not useful, but you might need just the `.open` or `.close` escape code if you're mixing externally styled strings with yours. + +```js +var chalk = require('chalk'); + +console.log(chalk.styles.red); +//=> {open: '\x1b[31m', close: '\x1b[39m'} + +console.log(chalk.styles.red.open + 'Hello' + chalk.styles.red.close); +``` + +### chalk.stripColor(string) + +[Strip color](https://github.com/sindresorhus/strip-ansi) from a string. + +Can be useful in combination with `.supportsColor` to strip color on externally styled text when it's not supported. + +Example: + +```js +var chalk = require('chalk'); +var styledString = fromExternal(); + +if (!chalk.supportsColor) { + chalk.stripColor(styledString); +} +``` + + +## Styles + +### General + +- reset +- bold +- italic +- underline +- inverse +- strikethrough + +### Text colors + +- black +- red +- green +- yellow +- blue +- magenta +- cyan +- white +- gray + +### Background colors + +- bgBlack +- bgRed +- bgGreen +- bgYellow +- bgBlue +- bgMagenta +- bgCyan +- bgWhite + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) + + +- + +[](https://bitdeli.com/free "Bitdeli Badge") diff --git a/node_modules/time-require/node_modules/parse-ms/index.js b/node_modules/time-require/node_modules/parse-ms/index.js new file mode 100644 index 000000000..24f775d43 --- /dev/null +++ b/node_modules/time-require/node_modules/parse-ms/index.js @@ -0,0 +1,14 @@ +'use strict'; +module.exports = function (ms) { + if (typeof ms !== 'number') { + throw new TypeError('Expected a number'); + } + + return { + days: Math.floor(ms / 86400000), + hours: Math.floor(ms / 3600000 % 24), + minutes: Math.floor(ms / 60000 % 60), + seconds: Math.floor(ms / 1000 % 60), + milliseconds: Math.floor(ms % 1000) + }; +}; diff --git a/node_modules/time-require/node_modules/parse-ms/package.json b/node_modules/time-require/node_modules/parse-ms/package.json new file mode 100644 index 000000000..3df5f30e2 --- /dev/null +++ b/node_modules/time-require/node_modules/parse-ms/package.json @@ -0,0 +1,36 @@ +{ + "name": "parse-ms", + "version": "0.1.2", + "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", + "browser": "browserify -s $npm_package_name -o browser.js ." + }, + "files": [ + "index.js" + ], + "keywords": [ + "browser", + "parse", + "time", + "ms", + "milliseconds", + "duration", + "period", + "range" + ], + "devDependencies": { + "mocha": "*", + "browserify": "^3.0.0" + } +} diff --git a/node_modules/time-require/node_modules/parse-ms/readme.md b/node_modules/time-require/node_modules/parse-ms/readme.md new file mode 100644 index 000000000..ded23c56f --- /dev/null +++ b/node_modules/time-require/node_modules/parse-ms/readme.md @@ -0,0 +1,31 @@ +# parse-ms [](https://travis-ci.org/sindresorhus/parse-ms) + +> Parse milliseconds into an object + + +## Install + +```sh +$ npm install --save parse-ms +``` + +```sh +$ bower install --save parse-ms +``` + +```sh +$ component install sindresorhus/parse-ms +``` + + +## Usage + +```js +parseMs(1337000001); +//=> { days: 15, hours: 11, minutes: 23, seconds: 20, milliseconds: 1 } +``` + + +## License + +[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/time-require/node_modules/pretty-ms/cli.js b/node_modules/time-require/node_modules/pretty-ms/cli.js new file mode 100755 index 000000000..529fec3fe --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/cli.js @@ -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); +} diff --git a/node_modules/time-require/node_modules/pretty-ms/index.js b/node_modules/time-require/node_modules/pretty-ms/index.js new file mode 100644 index 000000000..4c3db8bc7 --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/index.js @@ -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(' '); +}; diff --git a/node_modules/time-require/node_modules/pretty-ms/package.json b/node_modules/time-require/node_modules/pretty-ms/package.json new file mode 100644 index 000000000..a561a12a2 --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/package.json @@ -0,0 +1,48 @@ +{ + "name": "pretty-ms", + "version": "0.2.2", + "description": "Convert milliseconds to a human readable string: 1337000000 ➔ 15d 11h 23m 20s", + "license": "MIT", + "repository": "sindresorhus/pretty-ms", + "bin": { + "pretty-ms": "cli.js" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "browser": "browserify -s $npm_package_name -o browser.js ." + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "browser", + "pretty", + "human", + "humanized", + "readable", + "time", + "ms", + "milliseconds", + "duration", + "period", + "range" + ], + "dependencies": { + "parse-ms": "^0.1.0" + }, + "devDependencies": { + "mocha": "*", + "browserify": "^3.0.0" + } +} diff --git a/node_modules/time-require/node_modules/pretty-ms/readme.md b/node_modules/time-require/node_modules/pretty-ms/readme.md new file mode 100644 index 000000000..cdad7db92 --- /dev/null +++ b/node_modules/time-require/node_modules/pretty-ms/readme.md @@ -0,0 +1,80 @@ +# pretty-ms [](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) diff --git a/node_modules/time-require/node_modules/strip-ansi/cli.js b/node_modules/time-require/node_modules/strip-ansi/cli.js new file mode 100755 index 000000000..f8019cdae --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/cli.js @@ -0,0 +1,27 @@ +#!/usr/bin/env node +'use strict'; +var fs = require('fs'); +var strip = require('./index'); +var input = process.argv[2]; + +if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) { + console.log('strip-ansi <input file> > <output file>'); + console.log('or'); + console.log('cat <input file> | strip-ansi > <output file>'); + return; +} + +if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) { + console.log(require('./package').version); + return; +} + +if (input) { + process.stdout.write(strip(fs.readFileSync(input, 'utf8'))); + return; +} + +process.stdin.setEncoding('utf8'); +process.stdin.on('data', function (data) { + process.stdout.write(strip(data)); +}); diff --git a/node_modules/time-require/node_modules/strip-ansi/index.js b/node_modules/time-require/node_modules/strip-ansi/index.js new file mode 100644 index 000000000..62320c591 --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +module.exports = function (str) { + return typeof str === 'string' ? str.replace(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]/g, '') : str; +}; diff --git a/node_modules/time-require/node_modules/strip-ansi/package.json b/node_modules/time-require/node_modules/strip-ansi/package.json new file mode 100644 index 000000000..406b90164 --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/package.json @@ -0,0 +1,53 @@ +{ + "name": "strip-ansi", + "version": "0.1.1", + "description": "Strip ANSI escape codes (used for colorizing strings in the terminal)", + "license": "MIT", + "bin": { + "strip-ansi": "cli.js" + }, + "repository": "sindresorhus/strip-ansi", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "mocha": "~1.x" + } +} diff --git a/node_modules/time-require/node_modules/strip-ansi/readme.md b/node_modules/time-require/node_modules/strip-ansi/readme.md new file mode 100644 index 000000000..eb661b3d8 --- /dev/null +++ b/node_modules/time-require/node_modules/strip-ansi/readme.md @@ -0,0 +1,46 @@ +# strip-ansi [](http://travis-ci.org/sindresorhus/strip-ansi) + +> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) (used for colorizing strings in the terminal) + +Used in the terminal color module [chalk](https://github.com/sindresorhus/chalk). + + +## Install + +Install locally with [npm](https://npmjs.org/package/strip-ansi): + +``` +npm install --save strip-ansi +``` + +Or globally if you want to use it as a CLI app: + +``` +npm install --global strip-ansi +``` + +You can then use it in your Terminal like: + +``` +strip-ansi file-with-color-codes +``` + +Or pipe something to it: + +``` +ls | strip-ansi +``` + + +## Example + +```js +var stripAnsi = require('strip-ansi'); +stripAnsi('\x1b[4mcake\x1b[0m'); +//=> cake +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) |