Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

high-order

qix-58MIT0.1.1

Find the length of a UTF-8 glyph by its first byte

utf8, unicode, utf-8, ucs, first, byte, high, order, length, buffer

readme

node-high-order Travis-CI.org Build Status Coveralls.io Coverage Rating

Calculates the number of bytes in a UTF-8 glyph given just its first byte

Usage:

const highOrder = require('high-order');

console.log(highOrder(0xC0)); //-> 2
console.log(highOrder(0x01)); //-> 1

// continuation byte
console.log(highOrder(0x81)); //-> 0

console.log(Buffer('🦄')[0])); //-> 4

License

Licensed under the MIT License. You can find a copy of it in LICENSE.