[Pkg-javascript-commits] [node-entities] 59/63: encode: fix `escape`, expose it
Wolfgang Borgert
debacle at moszumanska.debian.org
Mon Sep 22 08:15:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch master
in repository node-entities.
commit c25fdb0a1129ea1605106b7ec3f500959176e8cc
Author: fb55 <me at feedic.com>
Date: Sun Apr 13 22:39:51 2014 +0200
encode: fix `escape`, expose it
---
index.js | 2 ++
lib/encode.js | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/index.js b/index.js
index fc55809..3353c1a 100644
--- a/index.js
+++ b/index.js
@@ -29,3 +29,5 @@ exports.decodeHTML = decode.HTML;
exports.decodeHTML4Strict =
exports.decodeHTML5Strict =
exports.decodeHTMLStrict = decode.HTMLStrict;
+
+exports.escape = encode.escape;
diff --git a/lib/encode.js b/lib/encode.js
index b426855..13c7f6b 100644
--- a/lib/encode.js
+++ b/lib/encode.js
@@ -61,12 +61,13 @@ function getInverse(inverse, re){
};
}
-var re_charsToEscape = new RegExp(re_nonASCII.source + "|[" + Object.keys(inverseXML) + "]", "g");
+var re_xmlChars = getInverseReplacer(inverseXML);
function escapeXML(data){
return data
+ .replace(re_xmlChars, singleCharReplacer)
.replace(re_astralSymbols, astralReplacer)
- .replace(re_charsToEscape, singleCharReplacer);
+ .replace(re_nonASCII, singleCharReplacer);
}
exports.escape = escapeXML;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-entities.git
More information about the Pkg-javascript-commits
mailing list