https://github.com/gajus/normalize-id
Destructive foreign ID normalization.
https://github.com/gajus/normalize-id
identifier normalize
Last synced: 5 months ago
JSON representation
Destructive foreign ID normalization.
- Host: GitHub
- URL: https://github.com/gajus/normalize-id
- Owner: gajus
- License: other
- Created: 2020-02-07T03:49:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-07T04:50:07.000Z (about 6 years ago)
- Last Synced: 2025-08-27T23:59:22.791Z (6 months ago)
- Topics: identifier, normalize
- Language: JavaScript
- Size: 6.84 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# normalize-id
[](https://travis-ci.org/gajus/normalize-id)
[](https://coveralls.io/github/gajus/normalize-id)
[](https://www.npmjs.org/package/normalize-id)
[](https://github.com/gajus/canonical)
[](https://twitter.com/kuizinas)
Destructive foreign ID normalization.
## Use case
To normalize unstable inputs that are treated like IDs into a stable ID form.
This is useful when you do not trust the foreign ID representation to be stable, e.g. when you are treating URLs as IDs of a foreign resource and those URLs can have varying representation. However, it also means that two foreign IDs that vary in their semantic meaning only in characters that are removed or transliterated during normalization will produce the same ID, e.g. `deja` and `déjà` are both normalized to `DEJA`.
Although arbitrary, the applied normalization rules are derived through trial-and-error by aggregating data from thousands of different websites and optimizing for the most stable outputs with the least collisions.
The normalized IDs conform to `^(?!_)[A-Z0-9_]+(?