diff --git a/lib/rules_inline/escape.js b/lib/rules_inline/escape.js index 81201f0..5c68a23 100644 --- a/lib/rules_inline/escape.js +++ b/lib/rules_inline/escape.js @@ -1,8 +1,9 @@ // Proceess escaped chars and hardbreaks -var ESCAPED = '\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-' - .split('') - .map(function(ch) { return ch.charCodeAt(0); }); +var ESCAPED = {}; + +'\\!"#$%&\'()*+,./:;<=>?@[]^_`{|}~-' + .split('').forEach(function(ch) { ESCAPED[ch.charCodeAt(0)] = true; }); module.exports = function escape(state) { var ch, pos = state.pos, max = state.posMax; @@ -14,7 +15,7 @@ module.exports = function escape(state) { if (pos < max) { ch = state.src.charCodeAt(pos); - if (ESCAPED.indexOf(ch) >= 0) { + if (typeof ESCAPED[ch] !== 'undefined') { // escape html chars if needed if (ch === 0x26/* & */) { state.pending += '&';