UNPKG

unicodechar-string

Version:

Convert unicode escape sequence to a character!

8 lines (6 loc) 172 B
'use strict'; module.exports = str => { return str.replace(/\\u[\dA-Fa-f]{4}/g, match => { return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16)); }); };