mirror of
				https://gitlab.com/ceda_ei/better-strip-color.git
				synced 2025-11-04 08:20:06 +01:00 
			
		
		
		
	Compare commits
	
		
			3 Commits
		
	
	
		
			810b8c6f2e
			...
			a9a775c15a
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| a9a775c15a | |||
| 5cb9cc158a | |||
| ef5d0780c7 | 
							
								
								
									
										22
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								README.md
									
									
									
									
									
								
							@@ -1,3 +1,23 @@
 | 
			
		||||
# better-strip-color
 | 
			
		||||
 | 
			
		||||
Strip ansi characters from a string.
 | 
			
		||||
Strip ansi colors, attributes from a string.
 | 
			
		||||
 | 
			
		||||
## Install
 | 
			
		||||
 | 
			
		||||
Install with [npm](https://www.npmjs.com/) or [pnpm](https://pnpm.js.org/)
 | 
			
		||||
 | 
			
		||||
```sh
 | 
			
		||||
$ npm i better-strip-color
 | 
			
		||||
$ pnpm i better-strip-color
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
 | 
			
		||||
```js
 | 
			
		||||
const strip = require("better-strip-color");
 | 
			
		||||
const strippedString = strip(ANSIString);
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## License
 | 
			
		||||
 | 
			
		||||
Released under the LGPL-3.0 license.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								index.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
'use strict';
 | 
			
		||||
 | 
			
		||||
module.exports = function(str) {
 | 
			
		||||
	return str.replace(/\033(\[(\[H\033\[2J|\d+;\d+H|\d+(;\d+;\d+(;\d+;\d+)?m|[mABCDFGd])|[HJK]|1K)|[78]|\d*[PMX]|\(B\033\[m)/g, '');
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										56
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "better-strip-color",
 | 
			
		||||
  "version": "1.0.2",
 | 
			
		||||
  "description": "Strip ANSI colors, attributes from a string",
 | 
			
		||||
  "main": "index.js",
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "test": "echo \"Error: no test specified\" && exit 1"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "git+https://gitlab.com/ceda_ei/better-strip-color.git"
 | 
			
		||||
  },
 | 
			
		||||
  "keywords": [
 | 
			
		||||
    "ansi",
 | 
			
		||||
    "chalk",
 | 
			
		||||
    "cli",
 | 
			
		||||
    "codes",
 | 
			
		||||
    "color",
 | 
			
		||||
    "colors",
 | 
			
		||||
    "colour",
 | 
			
		||||
    "colours",
 | 
			
		||||
    "command",
 | 
			
		||||
    "command-line",
 | 
			
		||||
    "console",
 | 
			
		||||
    "escape",
 | 
			
		||||
    "format",
 | 
			
		||||
    "formatting",
 | 
			
		||||
    "log",
 | 
			
		||||
    "logging",
 | 
			
		||||
    "match",
 | 
			
		||||
    "pattern",
 | 
			
		||||
    "re",
 | 
			
		||||
    "regex",
 | 
			
		||||
    "regexp",
 | 
			
		||||
    "regular-expression",
 | 
			
		||||
    "remove",
 | 
			
		||||
    "rgb",
 | 
			
		||||
    "shell",
 | 
			
		||||
    "string",
 | 
			
		||||
    "strip",
 | 
			
		||||
    "style",
 | 
			
		||||
    "styles",
 | 
			
		||||
    "styling",
 | 
			
		||||
    "terminal",
 | 
			
		||||
    "text",
 | 
			
		||||
    "trim",
 | 
			
		||||
    "tty",
 | 
			
		||||
    "xterm"
 | 
			
		||||
  ],
 | 
			
		||||
  "author": "Ceda EI",
 | 
			
		||||
  "license": "LGPL-3.0",
 | 
			
		||||
  "bugs": {
 | 
			
		||||
    "url": "https://gitlab.com/ceda_ei/better-strip-color/issues"
 | 
			
		||||
  },
 | 
			
		||||
  "homepage": "https://gitlab.com/ceda_ei/better-strip-color"
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user