JavaScript has a Unicode problem, see here for more information:
https://mathiasbynens.be/notes/javascript-unicode
'π©'.length
...results in 2 when you would have been expecting 1.
unicodeStringUtils.length('π©'); // 1
unicodeStringUtils.symbols('Hello π'); // ['H','e','l','l','o',' ','π']
unicodeStringUtils.slice('Boom π£ Pow π₯', -12, 6); // Boom π£
unicodeStringUtils.substring('Boom π£ Pow π₯', 7, 12); // Pow π₯
npm install -g mocha
mocha tests
- As mentioned in the above blog post, with ES6 you probably won't need these utils.
- If you already use lodash, you don't need this.
see: https://twitter.com/jdalton/status/643438391498010624