ansi-regex
Advanced tools
Comparing version 5.0.0 to 6.0.0
@@ -1,10 +0,8 @@ | ||
declare namespace ansiRegex { | ||
interface Options { | ||
/** | ||
Match only the first ANSI escape. | ||
export interface Options { | ||
/** | ||
Match only the first ANSI escape. | ||
@default false | ||
*/ | ||
onlyFirst: boolean; | ||
} | ||
@default false | ||
*/ | ||
readonly onlyFirst: boolean; | ||
} | ||
@@ -17,3 +15,3 @@ | ||
``` | ||
import ansiRegex = require('ansi-regex'); | ||
import ansiRegex from 'ansi-regex'; | ||
@@ -36,4 +34,2 @@ ansiRegex().test('\u001B[4mcake\u001B[0m'); | ||
*/ | ||
declare function ansiRegex(options?: ansiRegex.Options): RegExp; | ||
export = ansiRegex; | ||
export default function ansiRegex(options?: Options): RegExp; |
@@ -1,4 +0,2 @@ | ||
'use strict'; | ||
module.exports = ({onlyFirst = false} = {}) => { | ||
export default function ansiRegex({onlyFirst = false} = {}) { | ||
const pattern = [ | ||
@@ -10,2 +8,2 @@ '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', | ||
return new RegExp(pattern, onlyFirst ? undefined : 'g'); | ||
}; | ||
} |
{ | ||
"name": "ansi-regex", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Regular expression for matching ANSI escape codes", | ||
"license": "MIT", | ||
"repository": "chalk/ansi-regex", | ||
"funding": "https://github.com/chalk/ansi-regex?sponsor=1", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=12" | ||
}, | ||
@@ -51,6 +54,6 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^2.4.0", | ||
"tsd": "^0.9.0", | ||
"xo": "^0.25.3" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex) | ||
# ansi-regex | ||
> Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) | ||
## Install | ||
@@ -12,7 +11,6 @@ | ||
## Usage | ||
```js | ||
const ansiRegex = require('ansi-regex'); | ||
import ansiRegex from 'ansi-regex'; | ||
@@ -35,3 +33,2 @@ ansiRegex().test('\u001B[4mcake\u001B[0m'); | ||
## API | ||
@@ -49,3 +46,3 @@ | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `false` *(Matches any ANSI escape codes in a string)* | ||
@@ -55,3 +52,2 @@ | ||
## FAQ | ||
@@ -65,3 +61,2 @@ | ||
## Maintainers | ||
@@ -72,3 +67,2 @@ | ||
--- | ||
@@ -75,0 +69,0 @@ |
Sorry, the diff of this file is not supported yet
Yes
5631
32
73