html-entities
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.4.0 | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Html4Entities; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.4.0 | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -3,0 +3,0 @@ var Html5Entities; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.4.0 | ||
// Generated by CoffeeScript 1.3.3 | ||
(function() { | ||
@@ -61,20 +61,21 @@ | ||
} | ||
return str.replace(/&[a-zA-Z0-9]+;?/g, function(s, ent) { | ||
var a; | ||
if (a = alphaIndex[s]) { | ||
return a; | ||
return str.replace(/&#?[0-9a-zA-Z]+;?/g, function(s) { | ||
var a, code; | ||
if (s.charAt(1) === '#') { | ||
if (s.charAt(2).toLowerCase() === 'x') { | ||
code = parseInt(s.substr(3), 16); | ||
} else { | ||
code = parseInt(s.substr(2)); | ||
} | ||
if (isNaN(code) || code < -32768 || code > 65535) { | ||
return ''; | ||
} | ||
return String.fromCharCode(code); | ||
} else { | ||
return ''; | ||
if (a = alphaIndex[s]) { | ||
return a; | ||
} else { | ||
return ''; | ||
} | ||
} | ||
}).replace(/&#[0-9a-fx]+;?/g, function(s) { | ||
var code; | ||
if (s.charAt(2).toLowerCase() === 'x') { | ||
code = parseInt(s.substr(3), 16); | ||
} else { | ||
code = parseInt(s.substr(2)); | ||
} | ||
if (isNaN(code) || code < -32768 || code > 65535) { | ||
return ''; | ||
} | ||
return String.fromCharCode(code); | ||
}); | ||
@@ -81,0 +82,0 @@ }; |
{ | ||
"name": "html-entities", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Faster HTML entities encode/decode library.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
58739
478
1