aboutsummaryrefslogtreecommitdiff
path: root/lib/util.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.js')
-rw-r--r--lib/util.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js
index 9f17966..58bb4b0 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -169,6 +169,15 @@ u.escapeHTML = function (html) {
.replace(/>/g, '>')
}
+u.unescapeHTML = function (text) {
+ if (typeof text !== 'string') return text
+ return text.replace(/&/g, '&')
+ .replace(/"/g, '"')
+ .replace(/'/g, '\'')
+ .replace(/>/g, '>')
+ .replace(/&lt;/g, '<')
+}
+
u.pullSlice = function (start, end) {
if (end == null) end = Infinity
var offset = 0