pax_global_header00006660000000000000000000000064135614552030014516gustar00rootroot0000000000000052 comment=59533da99981f9d550de1ae0eb9d1a93c2383be3 strip-ansi-6.0.0/000077500000000000000000000000001356145520300136125ustar00rootroot00000000000000strip-ansi-6.0.0/.editorconfig000066400000000000000000000002571356145520300162730ustar00rootroot00000000000000root = 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-6.0.0/.gitattributes000066400000000000000000000000231356145520300165000ustar00rootroot00000000000000* text=auto eol=lf strip-ansi-6.0.0/.github/000077500000000000000000000000001356145520300151525ustar00rootroot00000000000000strip-ansi-6.0.0/.github/funding.yml000066400000000000000000000000561356145520300173300ustar00rootroot00000000000000github: sindresorhus tidelift: npm/strip-ansi strip-ansi-6.0.0/.github/security.md000066400000000000000000000002631356145520300173440ustar00rootroot00000000000000# Security Policy To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. strip-ansi-6.0.0/.gitignore000066400000000000000000000000271356145520300156010ustar00rootroot00000000000000node_modules yarn.lock strip-ansi-6.0.0/.npmrc000066400000000000000000000000231356145520300147250ustar00rootroot00000000000000package-lock=false strip-ansi-6.0.0/.travis.yml000066400000000000000000000000651356145520300157240ustar00rootroot00000000000000language: node_js node_js: - '12' - '10' - '8' strip-ansi-6.0.0/index.d.ts000066400000000000000000000005611356145520300155150ustar00rootroot00000000000000/** Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string. @example ``` import stripAnsi = require('strip-ansi'); stripAnsi('\u001B[4mUnicorn\u001B[0m'); //=> 'Unicorn' stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); //=> 'Click' ``` */ declare function stripAnsi(string: string): string; export = stripAnsi; strip-ansi-6.0.0/index.js000066400000000000000000000002321356145520300152540ustar00rootroot00000000000000'use strict'; const ansiRegex = require('ansi-regex'); module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; strip-ansi-6.0.0/index.test-d.ts000066400000000000000000000001731356145520300164710ustar00rootroot00000000000000import {expectType} from 'tsd'; import stripAnsi = require('.'); expectType(stripAnsi('\u001B[4mcake\u001B[0m')); strip-ansi-6.0.0/license000066400000000000000000000021251356145520300151570ustar00rootroot00000000000000MIT 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-6.0.0/package.json000066400000000000000000000014361356145520300161040ustar00rootroot00000000000000{ "name": "strip-ansi", "version": "6.0.0", "description": "Strip ANSI escape codes from a string", "license": "MIT", "repository": "chalk/strip-ansi", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { "node": ">=8" }, "scripts": { "test": "xo && ava && tsd" }, "files": [ "index.js", "index.d.ts" ], "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": "^5.0.0" }, "devDependencies": { "ava": "^2.4.0", "tsd": "^0.10.0", "xo": "^0.25.3" } } strip-ansi-6.0.0/readme.md000066400000000000000000000030771356145520300154000ustar00rootroot00000000000000# 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) from a string ## Install ``` $ npm install strip-ansi ``` ## Usage ```js const stripAnsi = require('strip-ansi'); stripAnsi('\u001B[4mUnicorn\u001B[0m'); //=> 'Unicorn' stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007'); //=> 'Click' ``` ## strip-ansi for enterprise Available as part of the Tidelift Subscription. The maintainers of strip-ansi and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-strip-ansi?utm_source=npm-strip-ansi&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) ## Related - [strip-ansi-cli](https://github.com/chalk/strip-ansi-cli) - CLI for this module - [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Streaming version of 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-) strip-ansi-6.0.0/test.js000066400000000000000000000011701356145520300151260ustar00rootroot00000000000000import test from 'ava'; import stripAnsi from '.'; test('strip color from string', t => { t.is(stripAnsi('\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(stripAnsi('\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(stripAnsi('\u001B[0;33;49;3;9;4mbar\u001B[0m'), 'bar'); }); test('strip link from terminal link', t => { t.is(stripAnsi('\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'), 'click'); });