irc-colors
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -24,3 +24,3 @@ var Hash = require('hashish'); | ||
var styles = { | ||
'\x00': 'normal', | ||
'\x0F': 'normal', | ||
'\x1F': 'underline', | ||
@@ -85,3 +85,14 @@ '\x02': 'bold', | ||
exports.stripColors = function(str) { | ||
return str.replace(/(\x03\d{0,2}(,\d{0,2})?)/g, ''); | ||
}; | ||
exports.stripStyle = function(str) { | ||
return str.replace(/[\x0F\x02\x16\x1F]/g, ''); | ||
}; | ||
exports.stripColorsAndStyle = function(str) { | ||
return exports.stripColors(exports.stripStyle(str)); | ||
}; | ||
// adds all functions to each other so they can be chained | ||
@@ -88,0 +99,0 @@ var addGetters = function(f1, name) { |
@@ -9,3 +9,3 @@ { | ||
], | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"repository": { | ||
@@ -12,0 +12,0 @@ "type": "git", |
@@ -53,3 +53,19 @@ # irc.colors.js [![Build Status](https://secure.travis-ci.org/fent/irc-colors.js.png)](http://travis-ci.org/fent/irc-colors.js) | ||
## Strip | ||
You can also strip out any colors/style from IRC messages. | ||
* `stripColors` | ||
* `stripStyle` | ||
* `stripColorsAndStyle` | ||
```js | ||
var c = require('irc-colors'); | ||
ircbot.on('message', function(from, message) { | ||
console.log(c.stripColorsAndStyle(message)); | ||
}); | ||
``` | ||
# Install | ||
@@ -56,0 +72,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
18786
121
86
0