{"id":18900,"library":"unorm","title":"unorm","description":"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.","status":"maintenance","version":"1.6.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/walling/unorm","tags":["javascript"],"install":[{"cmd":"npm install unorm","lang":"bash","label":"npm"},{"cmd":"yarn add unorm","lang":"bash","label":"yarn"},{"cmd":"pnpm add unorm","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"unorm is primarily CommonJS but can be imported via ESM if using bundler. The package does not ship TypeScript types.","wrong":"const unorm = require('unorm'); unorm.nfc()","symbol":"nfc","correct":"import { nfc } from 'unorm'"},{"note":"Default import from unorm is not defined; use named imports.","wrong":"import unorm from 'unorm'; unorm.nfd()","symbol":"nfd","correct":"import { nfd } from 'unorm'"},{"note":"Same pattern as nfc/nfd.","wrong":null,"symbol":"nfkc","correct":"import { nfkc } from 'unorm'"},{"note":"Same pattern.","wrong":null,"symbol":"nfkd","correct":"import { nfkd } from 'unorm'"}],"quickstart":{"code":"import { nfc, nfd, nfkc, nfkd } from 'unorm';\n\nconst text = '\\u212B\\u00C5ngstr\\u00F6m';\nconsole.log('NFC:', nfc(text));\nconsole.log('NFD:', nfd(text));\nconsole.log('NFKC:', nfkc(text));\nconsole.log('NFKD:', nfkd(text));","lang":"javascript","description":"Demonstrates all four Unicode normalization functions with a sample string."},"warnings":[{"fix":"Install @types/unorm from DefinitelyTyped or declare module 'unorm' in a .d.ts file.","message":"unorm does not ship TypeScript type definitions; users must create their own or use @types/unorm (community-maintained).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use built-in native normalize() if targeting Node.js >= 6 or modern browsers.","message":"String.prototype.normalize is available in Node.js >= 6 and modern browsers; unorm is only needed for polyfilling older environments.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Include es5-shim before unorm for legacy browser support.","message":"The package uses ECMAScript 5 features; older browsers (IE8 and below) require es5-shim.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use require() or configure bundler to handle CommonJS modules.","message":"unorm uses CommonJS module exports; direct ESM imports may fail in some bundlers without proper configuration.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Include unorm via a <script> tag: <script src=\"node_modules/unorm/unorm.js\"></script>, then use window.unorm.nfc()","cause":"Using unorm in a browser without a bundler or script tag.","error":"require is not defined"},{"fix":"Use named imports: import { nfc } from 'unorm'","cause":"Incorrect import (e.g., default import) when using ESM.","error":"TypeError: unorm.nfc is not a function"},{"fix":"Add unorm to vite's optimizeDeps.include: ['unorm']","cause":"Using Vite or similar bundler that treats CommonJS modules as external.","error":"Module \"unorm\" has been externalized for browser compatibility and cannot be accessed"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}