Socket
Socket
Sign inDemoInstall

has-ansi

Package Overview
Dependencies
2
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 1.0.0

30

cli.js
#!/usr/bin/env node
'use strict';
var stdin = require('get-stdin');
var pkg = require('./package.json');
var hasAnsi = require('./');
var input = process.argv[2];
var argv = process.argv.slice(2);
var input = argv[0];
function stdin(cb) {
var ret = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) {
ret += data;
});
process.stdin.on('end', function () {
cb(ret);
});
}
function help() {
console.log([
pkg.description,
'',
'Usage',
' $ has-ansi <string>',
' $ echo <string> | has-ansi',
' ' + pkg.description,
'',
'Exits with code 0 if input has ANSI escape codes and 1 if not'
' Usage',
' has-ansi <string>',
' echo <string> | has-ansi',
'',
' Exits with code 0 if input has ANSI escape codes and 1 if not'
].join('\n'));

@@ -34,3 +26,3 @@ }

if (process.argv.indexOf('--help') !== -1) {
if (argv.indexOf('--help') !== -1) {
help();

@@ -40,3 +32,3 @@ return;

if (process.argv.indexOf('--version') !== -1) {
if (argv.indexOf('--version') !== -1) {
console.log(pkg.version);

@@ -43,0 +35,0 @@ return;

{
"name": "has-ansi",
"version": "0.1.0",
"version": "1.0.0",
"description": "Check if a string has ANSI escape codes",
"license": "MIT",
"repository": "sindresorhus/has-ansi",
"bin": {
"has-ansi": "cli.js"
},
"author": {

@@ -15,2 +12,5 @@ "name": "Sindre Sorhus",

},
"bin": {
"has-ansi": "cli.js"
},
"engines": {

@@ -53,3 +53,4 @@ "node": ">=0.10.0"

"dependencies": {
"ansi-regex": "^0.2.0"
"ansi-regex": "^1.0.0",
"get-stdin": "^1.0.0"
},

@@ -56,0 +57,0 @@ "devDependencies": {

@@ -35,7 +35,7 @@ # has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi)

Usage
$ has-ansi <string>
$ echo <string> | has-ansi
Usage
has-ansi <string>
echo <string> | has-ansi
Exits with code 0 if input has ANSI escape codes and 1 if not
Exits with code 0 if input has ANSI escape codes and 1 if not
```

@@ -42,0 +42,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc