Created
January 5, 2017 15:47
-
-
Save davidsharp/18c19e70b4a53035157fd412dbb18b2e to your computer and use it in GitHub Desktop.
Swap `\u` escaped characters in a string into `String.fromCharCode` for JSX/React/React Native
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const uToJsx = s => s.replace(/\\u\d{4}/g,m=>(String.fromCharCode(parseInt(m.substring(2),16)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment