[Pkg-javascript-commits] [node-entities] 57/63: encode: added `escape` method
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 072fa433b2a3ce98f42a0e505084acff53fe94a3
Author: fb55 <me at feedic.com>
Date: Sun Apr 13 22:27:36 2014 +0200
encode: added `escape` method
---
lib/encode.js | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/lib/encode.js b/lib/encode.js
index 79119b7..1b44cbc 100644
--- a/lib/encode.js
+++ b/lib/encode.js
@@ -45,4 +45,14 @@ function getInverse(inverse, re){
.replace(re_astralSymbols, astralReplacer)
.replace(re_nonASCII, singleCharReplacer);
};
-}
\ No newline at end of file
+}
+
+var re_charsToEscape = new RegExp(re_nonASCII.source + "|[" + Object.keys(inverseXML) + "]", "g");
+
+function escapeXML(data){
+ return data
+ .replace(re_astralSymbols, astralReplacer)
+ .replace(re_charsToEscape, 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