Comparing version 0.0.3 to 0.0.4
@@ -42,6 +42,6 @@ var fs = require('fs'); | ||
return str | ||
.replace(/&#(\d+);?/, function (_, code) { | ||
.replace(/&#(\d+);?/g, function (_, code) { | ||
return String.fromCharCode(code); | ||
}) | ||
.replace(/&#[xX]([A-Fa-f0-9]+);?/, function (_, hex) { | ||
.replace(/&#[xX]([A-Fa-f0-9]+);?/g, function (_, hex) { | ||
return String.fromCharCode(parseInt(hex, 16)); | ||
@@ -48,0 +48,0 @@ }) |
{ | ||
"name": "ent", | ||
"description": "Encode and decode HTML entities", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"repository": "https://github.com/substack/node-ent.git", | ||
@@ -6,0 +6,0 @@ "author": "James Halliday <mail@substack.net> (http://substack.net)", |
@@ -23,2 +23,5 @@ var assert = require('assert'); | ||
assert.eql(ent.decode(b), a); | ||
assert.eql(ent.encode(a + a), b + b); | ||
assert.eql(ent.decode(b + b), a + a); | ||
}; | ||
@@ -48,6 +51,8 @@ | ||
var encoded = ent.encode(a); | ||
var encoded2 = ent.encode(a + a); | ||
if (!encoded.match(/^&\w+;/)) { | ||
assert.equal(encoded, '&#' + i + ';'); | ||
assert.equal(encoded2, '&#' + i + ';&#' + i + ';'); | ||
} | ||
} | ||
}; |
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
9475
365