UNPKG

379 BJavaScriptView Raw
1var toString = require('../lang/toString');
2
3 /**
4 * Unescape unicode char sequences
5 */
6 function unescapeUnicode(str){
7 str = toString(str);
8 return str.replace(/\\u[0-9a-f]{4}/g, function(ch){
9 var code = parseInt(ch.slice(2), 16);
10 return String.fromCharCode(code);
11 });
12 }
13
14 module.exports = unescapeUnicode;
15
16