diff options
author | Rebecca Turner <me@re-becca.org> | 2015-05-22 11:33:46 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2015-06-26 03:27:03 +0300 |
commit | d3c858ce4cfb3aee515bb299eb034fe1b5e44344 (patch) | |
tree | e7714c839934a729b68038f4c7dc5ec3ed877638 /node_modules/has-ansi | |
parent | 24564b9654528d23c726cf9ea82b1aef2044b692 (diff) |
deps: deduplicate npm@3 style
Diffstat (limited to 'node_modules/has-ansi')
-rwxr-xr-x | node_modules/has-ansi/cli.js | 45 | ||||
-rw-r--r-- | node_modules/has-ansi/index.js | 4 | ||||
-rw-r--r-- | node_modules/has-ansi/license | 21 | ||||
-rw-r--r-- | node_modules/has-ansi/package.json | 115 | ||||
-rw-r--r-- | node_modules/has-ansi/readme.md | 45 |
5 files changed, 230 insertions, 0 deletions
diff --git a/node_modules/has-ansi/cli.js b/node_modules/has-ansi/cli.js new file mode 100755 index 000000000..0386a8242 --- /dev/null +++ b/node_modules/has-ansi/cli.js @@ -0,0 +1,45 @@ +#!/usr/bin/env node +'use strict'; +var stdin = require('get-stdin'); +var pkg = require('./package.json'); +var hasAnsi = require('./'); +var argv = process.argv.slice(2); +var input = argv[0]; + +function help() { + console.log([ + '', + ' ' + pkg.description, + '', + ' Usage', + ' has-ansi <string>', + ' echo <string> | has-ansi', + '', + ' Exits with code 0 if input has ANSI escape codes and 1 if not' + ].join('\n')); +} + +function init(data) { + process.exit(hasAnsi(data) ? 0 : 1); +} + +if (argv.indexOf('--help') !== -1) { + help(); + return; +} + +if (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/has-ansi/index.js b/node_modules/has-ansi/index.js new file mode 100644 index 000000000..98fae0676 --- /dev/null +++ b/node_modules/has-ansi/index.js @@ -0,0 +1,4 @@ +'use strict'; +var ansiRegex = require('ansi-regex'); +var re = new RegExp(ansiRegex().source); // remove the `g` flag +module.exports = re.test.bind(re); diff --git a/node_modules/has-ansi/license b/node_modules/has-ansi/license new file mode 100644 index 000000000..654d0bfe9 --- /dev/null +++ b/node_modules/has-ansi/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/has-ansi/package.json b/node_modules/has-ansi/package.json new file mode 100644 index 000000000..b661ccd4a --- /dev/null +++ b/node_modules/has-ansi/package.json @@ -0,0 +1,115 @@ +{ + "_args": [ + [ + "has-ansi@^1.0.3", + "/Users/rebecca/code/npm/node_modules/chalk" + ] + ], + "_from": "has-ansi@>=1.0.3 <2.0.0", + "_id": "has-ansi@1.0.3", + "_inCache": true, + "_location": "/has-ansi", + "_nodeVersion": "0.10.35", + "_npmUser": { + "email": "jappelman@xebia.com", + "name": "jbnicolai" + }, + "_npmVersion": "2.1.16", + "_phantomChildren": {}, + "_requested": { + "name": "has-ansi", + "raw": "has-ansi@^1.0.3", + "rawSpec": "^1.0.3", + "scope": null, + "spec": ">=1.0.3 <2.0.0", + "type": "range" + }, + "_requiredBy": [ + "/chalk" + ], + "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", + "_shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "_shrinkwrap": null, + "_spec": "has-ansi@^1.0.3", + "_where": "/Users/rebecca/code/npm/node_modules/chalk", + "author": { + "email": "sindresorhus@gmail.com", + "name": "Sindre Sorhus", + "url": "http://sindresorhus.com" + }, + "bin": { + "has-ansi": "cli.js" + }, + "bugs": { + "url": "https://github.com/sindresorhus/has-ansi/issues" + }, + "dependencies": { + "ansi-regex": "^1.1.0", + "get-stdin": "^4.0.1" + }, + "description": "Check if a string has ANSI escape codes", + "devDependencies": { + "mocha": "*" + }, + "directories": {}, + "dist": { + "shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz" + }, + "engines": { + "node": ">=0.10.0" + }, + "files": [ + "cli.js", + "index.js" + ], + "gitHead": "416428ed16f8e9718aec54cea083173af6019917", + "homepage": "https://github.com/sindresorhus/has-ansi", + "keywords": [ + "ansi", + "bin", + "cli", + "color", + "colors", + "colour", + "command-line", + "console", + "escape", + "find", + "has", + "match", + "pattern", + "re", + "regex", + "regexp", + "shell", + "string", + "styles", + "terminal", + "test", + "text", + "tty", + "xterm" + ], + "license": "MIT", + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "name": "has-ansi", + "optionalDependencies": {}, + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/has-ansi" + }, + "scripts": { + "test": "mocha" + }, + "version": "1.0.3" +} diff --git a/node_modules/has-ansi/readme.md b/node_modules/has-ansi/readme.md new file mode 100644 index 000000000..0fa149a82 --- /dev/null +++ b/node_modules/has-ansi/readme.md @@ -0,0 +1,45 @@ +# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) + +> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save has-ansi +``` + + +## Usage + +```js +var hasAnsi = require('has-ansi'); + +hasAnsi('\u001b[4mcake\u001b[0m'); +//=> true + +hasAnsi('cake'); +//=> false +``` + + +## CLI + +```sh +$ npm install --global has-ansi +``` + +``` +$ has-ansi --help + + Usage + has-ansi <string> + echo <string> | has-ansi + + Exits with code 0 if input has ANSI escape codes and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) |