Registry / serialization / unorm
library1.6.0jsnpmunverified

JavaScript library for Unicode normalization forms NFC, NFD, NFKC, and NFKD, compliant with Unicode 8.0. The package provides simple functions to normalize strings according to the Unicode Standard Annex #15. Version 1.6.0 is the latest stable release, last updated in 2019. It is a CommonJS module but also ships a browser bundle as a global. This library is a polyfill for String.prototype.normalize and is useful for text processing, internationalization, and ensuring consistent string comparison. Unlike the built-in normalizer (added in ES6), unorm works in older environments and offers fine-grained control. It has no external dependencies and is lightweight.

npm install unorm
INSTALL
IMPORT
SIG · UNORM
U
unorm
serializationjavascriptv1.6.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nfc
✓ import { nfc } from 'unorm'
✗ const unorm = require('unorm'); unorm.nfc()
unorm is primarily CommonJS but can be imported via ESM if using bundler. The package does not ship TypeScript types.
nfd
✓ import { nfd } from 'unorm'
✗ import unorm from 'unorm'; unorm.nfd()
Default import from unorm is not defined; use named imports.
nfkc
✓ import { nfkc } from 'unorm'
Same pattern as nfc/nfd.
nfkd
✓ import { nfkd } from 'unorm'
Same pattern.

Demonstrates all four Unicode normalization functions with a sample string.

import { nfc, nfd, nfkc, nfkd } from 'unorm'; const text = '\u212B\u00C5ngstr\u00F6m'; console.log('NFC:', nfc(text)); console.log('NFD:', nfd(text)); console.log('NFKC:', nfkc(text)); console.log('NFKD:', nfkd(text));
Debug
Known issues
gotchaunorm does not ship TypeScript type definitions; users must create their own or use @types/unorm (community-maintained).
fix
Install @types/unorm from DefinitelyTyped or declare module 'unorm' in a .d.ts file.
affects: >=1.0.0
deprecatedString.prototype.normalize is available in Node.js >= 6 and modern browsers; unorm is only needed for polyfilling older environments.
fix
Use built-in native normalize() if targeting Node.js >= 6 or modern browsers.
affects: >=1.0.0
gotchaThe package uses ECMAScript 5 features; older browsers (IE8 and below) require es5-shim.
fix
Include es5-shim before unorm for legacy browser support.
affects: >=1.0.0
gotchaunorm uses CommonJS module exports; direct ESM imports may fail in some bundlers without proper configuration.
fix
Use require() or configure bundler to handle CommonJS modules.
affects: >=1.0.0
Errors
Common errors & fixes
require is not defined
Using unorm in a browser without a bundler or script tag.
fix
Include unorm via a <script> tag: <script src="node_modules/unorm/unorm.js"></script>, then use window.unorm.nfc()
TypeError: unorm.nfc is not a function
Incorrect import (e.g., default import) when using ESM.
fix
Use named imports: import { nfc } from 'unorm'
Module "unorm" has been externalized for browser compatibility and cannot be accessed
Using Vite or similar bundler that treats CommonJS modules as external.
fix
Add unorm to vite's optimizeDeps.include: ['unorm']
Upgrade
Version history
1.6.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
42 hits · last 30 days
node
34
Anthropic
2
Amazon
1
OpenAI (training)
1
Resources
unorm — npm install unorm · libregistry