Skip to content

Commit

Permalink
Meta tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 18, 2019
1 parent 89dc7f6 commit 81cd3cc
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
15 changes: 13 additions & 2 deletions index.d.ts
@@ -1,4 +1,15 @@
/**
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code).
Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
@example
```
import stripAnsi from 'strip-ansi';
stripAnsi('\u001B[4mUnicorn\u001B[0m');
//=> 'Unicorn'
stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
//=> 'Click'
```
*/
export default function stripAnsi(str: string): string;
export default function stripAnsi(string: string): string;
2 changes: 1 addition & 1 deletion index.js
@@ -1,7 +1,7 @@
'use strict';
const ansiRegex = require('ansi-regex');

const stripAnsi = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input;
const stripAnsi = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;

module.exports = stripAnsi;
module.exports.default = stripAnsi;
2 changes: 1 addition & 1 deletion index.test-d.ts
@@ -1,4 +1,4 @@
import {expectType} from 'tsd-check';
import stripAnsi from '.';

expectType<string>(stripAnsi('\u001b[4mcake\u001b[0m'));
expectType<string>(stripAnsi('\u001B[4mcake\u001B[0m'));
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "strip-ansi",
"version": "5.1.0",
"description": "Strip ANSI escape codes",
"description": "Strip ANSI escape codes from a string",
"license": "MIT",
"repository": "chalk/strip-ansi",
"author": {
Expand Down
2 changes: 1 addition & 1 deletion readme.md
@@ -1,6 +1,6 @@
# 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)
> Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string
---

Expand Down

0 comments on commit 81cd3cc

Please sign in to comment.