pax_global_header00006660000000000000000000000064131222735300014510gustar00rootroot0000000000000052 comment=c299056a42b31d7a479d6a89b41318b2a2462cc7 strip-ansi-4.0.0/000077500000000000000000000000001312227353000136025ustar00rootroot00000000000000strip-ansi-4.0.0/.editorconfig000066400000000000000000000002571312227353000162630ustar00rootroot00000000000000root = true [*] indent_style = tab end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.yml] indent_style = space indent_size = 2 strip-ansi-4.0.0/.gitattributes000066400000000000000000000000351312227353000164730ustar00rootroot00000000000000* text=auto *.js text eol=lf strip-ansi-4.0.0/.gitignore000066400000000000000000000000151312227353000155660ustar00rootroot00000000000000node_modules strip-ansi-4.0.0/.travis.yml000066400000000000000000000000631312227353000157120ustar00rootroot00000000000000language: node_js node_js: - '8' - '6' - '4' strip-ansi-4.0.0/index.js000066400000000000000000000002261312227353000152470ustar00rootroot00000000000000'use strict'; const ansiRegex = require('ansi-regex'); module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input; strip-ansi-4.0.0/license000066400000000000000000000021251312227353000151470ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (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. strip-ansi-4.0.0/package.json000066400000000000000000000014531312227353000160730ustar00rootroot00000000000000{ "name": "strip-ansi", "version": "4.0.0", "description": "Strip ANSI escape codes", "license": "MIT", "repository": "chalk/strip-ansi", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=4" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "strip", "trim", "remove", "ansi", "styles", "color", "colour", "colors", "terminal", "console", "string", "tty", "escape", "formatting", "rgb", "256", "shell", "xterm", "log", "logging", "command-line", "text" ], "dependencies": { "ansi-regex": "^3.0.0" }, "devDependencies": { "ava": "*", "xo": "*" } } strip-ansi-4.0.0/readme.md000066400000000000000000000015441312227353000153650ustar00rootroot00000000000000# strip-ansi [![Build Status](https://travis-ci.org/chalk/strip-ansi.svg?branch=master)](https://travis-ci.org/chalk/strip-ansi) > Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) ## Install ``` $ npm install strip-ansi ``` ## Usage ```js const stripAnsi = require('strip-ansi'); stripAnsi('\u001B[4mUnicorn\u001B[0m'); //=> 'Unicorn' ``` ## Related - [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module - [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes - [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right ## Maintainers - [Sindre Sorhus](https://github.com/sindresorhus) - [Josh Junon](https://github.com/qix-) ## License MIT strip-ansi-4.0.0/test.js000066400000000000000000000007171312227353000151240ustar00rootroot00000000000000import test from 'ava'; import m from '.'; test('strip color from string', t => { t.is(m('\u001B[0m\u001B[4m\u001B[42m\u001B[31mfoo\u001B[39m\u001B[49m\u001B[24mfoo\u001B[0m'), 'foofoo'); }); test('strip color from ls command', t => { t.is(m('\u001B[00;38;5;244m\u001B[m\u001B[00;38;5;33mfoo\u001B[0m'), 'foo'); }); test('strip reset;setfg;setbg;italics;strike;underline sequence from string', t => { t.is(m('\u001B[0;33;49;3;9;4mbar\u001B[0m'), 'bar'); });