Isomorphic Unicode Codepoint to/from String converter
about
implementation of Obtain Unicode Algorithm from DOMString at http://www.w3.org/TR/WebIDL/#dfn-obtain-unicode
also polyfill of String.fromCodePoint() for convert codepoints to string. https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint#Polyfill
install
$ npm install obtain-unicode
usage
works in node and browser. Isomorphic !! no Browserify.
; console.logobtainUnicode'beer!🍻';// [98, 101, 101, 114, 33, 127867]console.logString.fromCodePoint98, 101, 101, 114, 33, 127867;// "beer!🍻
test
$ npm test
and also open test/index.html in your browser and see console.
for TypeScript
and also add this type declare to your code. (because d.ts can't include this)
// polyfill for String.fromCodePointdeclare
License
The MIT License (MIT) Copyright (c) 2015 Jxck