html-entities
Advanced tools
Comparing version 1.0.7 to 1.0.8
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
@@ -24,3 +24,3 @@ var Html4Entities; | ||
c = htmlCodes[i]; | ||
alphaIndex[a] = c; | ||
alphaIndex[a] = String.fromCharCode(c); | ||
numIndex[c] = a; | ||
@@ -35,3 +35,4 @@ i++; | ||
return str.replace(/&(#?[\w\d]+);?/g, function(s, entity) { | ||
var code; | ||
var chr, code; | ||
chr = ''; | ||
if (entity.charAt(0) === "#") { | ||
@@ -43,9 +44,14 @@ if (entity.charAt(1).toLowerCase() === 'x') { | ||
} | ||
if (isNaN(code) || code < -32768 || code > 65535) { | ||
chr = ''; | ||
} else { | ||
chr = String.fromCharCode(code); | ||
} | ||
} else { | ||
code = alphaIndex[entity] || alphaIndex[entity.toLowerCase()]; | ||
chr = alphaIndex[entity]; | ||
} | ||
if (code === void 0 || isNaN(code) || code < -32768 || code > 65535) { | ||
return ""; | ||
if (chr === void 0) { | ||
return s; | ||
} else { | ||
return String.fromCharCode(code); | ||
return chr; | ||
} | ||
@@ -52,0 +58,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
@@ -61,3 +61,3 @@ var Html5Entities; | ||
if (char === void 0) { | ||
return ""; | ||
return s; | ||
} else { | ||
@@ -64,0 +64,0 @@ return char; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 1.3.3 | ||
// Generated by CoffeeScript 1.4.0 | ||
(function() { | ||
@@ -11,21 +11,11 @@ | ||
'<': '<', | ||
'<': '<', | ||
'>': '>', | ||
'>': '>', | ||
'"': '"', | ||
'"': '"', | ||
'&apos': '\'', | ||
'&APOS': '\'', | ||
'&': '&', | ||
'&': '&', | ||
'<': '<', | ||
'<': '<', | ||
'>': '>', | ||
'>': '>', | ||
'"': '"', | ||
'"': '"', | ||
''': '\'', | ||
'&APOS;': '\'', | ||
'&': '&', | ||
'&': '&' | ||
'&': '&' | ||
}; | ||
@@ -78,3 +68,3 @@ | ||
} else { | ||
return ''; | ||
return s; | ||
} | ||
@@ -81,0 +71,0 @@ } |
{ | ||
"name": "html-entities", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "Faster HTML entities encode/decode library.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -55,2 +55,2 @@ node-html-entities | ||
* encodeNonUTF — encodes, replacing characters to its entity representations. Inserts numeric entities for UTF characters. | ||
* decode — decodes, replacing entities to characters. Unknown entities are removed. | ||
* decode — decodes, replacing entities to characters. Unknown entities are left as is. |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
0
58638
474