Skip to content

Instantly share code, notes, and snippets.

@davidsharp
Created January 5, 2017 15:47
Show Gist options
  • Select an option

  • Save davidsharp/18c19e70b4a53035157fd412dbb18b2e to your computer and use it in GitHub Desktop.

Select an option

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
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