@http404/unicode-range
v0.0.5
Published
Unicode-range parser/builder
Downloads
7
Maintainers
Readme
@http404/unicode-range
Unicode parsing made simple, safe, and supercharged! 🚀
@http404/unicode-range is an ECMAScript Module (ESM) JavaScript library designed for parsing, validating, and stringifying CSS unicode-range values. It supports unicode-range strings as specified in the CSS Fonts specification. This package is based on @japont/unicode-range and provides enhanced performance and additional features.
See the added features in our docs.
Install
npm i @http404/unicode-range[!NOTE] This package is ESM-only and cannot be imported using require() from CommonJS. For more information, see this guide
Usage
import UnicodeRange from '@http404/unicode-range';
// Parse ( e.g. U+30-39 -> [30, 31, ..., 39] )
const Hiragana = UnicodeRange
.parse('U+3041-3096, U+3099-309F')
.map(cp => String.fromCodePoint(cp));
console.log(Hiragana);
// Stringify ( e.g. [30, 31, ..., 39] -> U+30-39 )
const DigitCodePoints = '0123456789'.split('').map(c => c.codePointAt(0));
const DigitUnicodeRange = UnicodeRange.stringify(DigitCodePoints);
console.log(DigitUnicodeRange);Contribute
Yes.
License
MIT License
