An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# normalize-id

[![Travis build status](http://img.shields.io/travis/gajus/normalize-id/master.svg?style=flat-square)](https://travis-ci.org/gajus/normalize-id)
[![Coveralls](https://img.shields.io/coveralls/gajus/normalize-id.svg?style=flat-square)](https://coveralls.io/github/gajus/normalize-id)
[![NPM version](http://img.shields.io/npm/v/normalize-id.svg?style=flat-square)](https://www.npmjs.org/package/normalize-id)
[![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical)
[![Twitter Follow](https://img.shields.io/twitter/follow/kuizinas.svg?style=social&label=Follow)](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_]+(?