pax_global_header00006660000000000000000000000064141177120430014512gustar00rootroot0000000000000052 comment=a285373adebe5e01f325d5a2e9df2686a09bc0d7 has-ansi-5.0.1/000077500000000000000000000000001411771204300132205ustar00rootroot00000000000000has-ansi-5.0.1/.editorconfig000066400000000000000000000002571411771204300157010ustar00rootroot00000000000000root = 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 has-ansi-5.0.1/.gitattributes000066400000000000000000000000231411771204300161060ustar00rootroot00000000000000* text=auto eol=lf has-ansi-5.0.1/.github/000077500000000000000000000000001411771204300145605ustar00rootroot00000000000000has-ansi-5.0.1/.github/funding.yml000066400000000000000000000000641411771204300167350ustar00rootroot00000000000000github: [sindresorhus, Qix-] tidelift: npm/has-ansi has-ansi-5.0.1/.github/security.md000066400000000000000000000002631411771204300167520ustar00rootroot00000000000000# Security Policy To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. has-ansi-5.0.1/.github/workflows/000077500000000000000000000000001411771204300166155ustar00rootroot00000000000000has-ansi-5.0.1/.github/workflows/main.yml000066400000000000000000000006451411771204300202710ustar00rootroot00000000000000name: CI on: - push - pull_request jobs: test: name: Node.js ${{ matrix.node-version }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: - 14 - 12 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: ${{ matrix.node-version }} - run: npm install - run: npm test has-ansi-5.0.1/.gitignore000066400000000000000000000000271411771204300152070ustar00rootroot00000000000000node_modules yarn.lock has-ansi-5.0.1/.npmrc000066400000000000000000000000231411771204300143330ustar00rootroot00000000000000package-lock=false has-ansi-5.0.1/index.js000066400000000000000000000002321411771204300146620ustar00rootroot00000000000000import ansiRegex from 'ansi-regex'; const regex = ansiRegex({onlyFirst: true}); export default function hasAnsi(string) { return regex.test(string); } has-ansi-5.0.1/license000066400000000000000000000021351411771204300145660ustar00rootroot00000000000000MIT License Copyright (c) Sindre Sorhus (https://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. has-ansi-5.0.1/package.json000066400000000000000000000015261411771204300155120ustar00rootroot00000000000000{ "name": "has-ansi", "version": "5.0.1", "description": "Check if a string has ANSI escape codes", "license": "MIT", "repository": "chalk/has-ansi", "funding": "https://github.com/chalk/has-ansi?sponsor=1", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "https://sindresorhus.com" }, "type": "module", "exports": "./index.js", "engines": { "node": ">=12" }, "scripts": { "test": "xo && ava" }, "files": [ "index.js" ], "keywords": [ "ansi", "styles", "color", "colour", "colors", "terminal", "console", "string", "tty", "escape", "shell", "xterm", "command-line", "text", "regex", "regexp", "match", "test", "find", "pattern", "has" ], "dependencies": { "ansi-regex": "^6.0.1" }, "devDependencies": { "ava": "^3.15.0", "xo": "^0.44.0" } } has-ansi-5.0.1/readme.md000066400000000000000000000022251411771204300150000ustar00rootroot00000000000000# has-ansi > Check if a string has [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) ## Install ``` $ npm install has-ansi ``` ## Usage ```js import hasAnsi from 'has-ansi'; hasAnsi('\u001B[4mUnicorn\u001B[0m'); //=> true hasAnsi('cake'); //=> false ``` ## Related - [has-ansi-cli](https://github.com/chalk/has-ansi-cli) - CLI for this module - [strip-ansi](https://github.com/chalk/strip-ansi) - Strip 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-) ---
Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.
has-ansi-5.0.1/test.js000066400000000000000000000002351411771204300145350ustar00rootroot00000000000000import test from 'ava'; import hasAnsi from './index.js'; test('main', t => { t.true(hasAnsi('foo\u001B[4mcake\u001B[0m')); t.false(hasAnsi('cake')); });