README
This is Unicode Normalizer in a Common JS module. I'm not affiliated with Matsuza, the original author of Unicode Normalizer.
Installation
Polyfill
You can use this module as a polyfill for String.prototype.normalize, for example:
The module uses some EcmaScript 5 features. Other browsers should use a compability shim, e.g. es5-shim.
Functions
This module exports four functions: nfc
, nfd
, nfkc
, and nfkd
; one for each Unicode normalization. In the browser the functions are exported in the unorm
global. In CommonJS environments you just require the module. Functions:
unorm.nfd(str)
– Canonical Decompositionunorm.nfc(str)
– Canonical Decomposition, followed by Canonical Compositionunorm.nfkd(str)
– Compatibility Decompositionunorm.nfkc(str)
– Compatibility Decomposition, followed by Canonical Composition
Node.JS example
For a longer example, see examples
directory.
Road map
As of November 2013. Longer term:
Look at possible optimizations (speed primarely, module size secondarily)
Adding functions to quick check normalizations:
is_nfc
,is_nfd
, etc.
Contributers
Oleg Grenrus is helping to maintain this library. He cleaned up the code base, fixed JSHint errors, created a test suite and updated the normalization data to Unicode 6.3.
Development notes
Unicode data can be found from http://www.unicode.org/Public/UCD/latest/ucd
To generate new unicode data, run:
produced unormdata.js
contains needed table
Execute node benchmark/benchmark.js
to run simple benchmarks, if you do any changes which may affect performance.
License
This project includes the software package Unicode Normalizer 1.0.0. The software dual licensed under the MIT and GPL licenses. Here is the MIT license:
Last updated