@phensley/locale-matcher

Implements distance based locale matching using the CLDR enhanced language matching algorithm.
Installation
NPM:
npm install --save @phensley/locale-matcher
Yarn:
yarn add @phensley/locale-matcher
Examples
import { LocaleMatch, LocaleMatcher } from '@phensley/locale-matcher';
const matcher = new LocaleMatcher('en, en_GB, zh, pt_AR, es-419');
let m: LocaleMatch;
m = matcher.match('en-AU');
console.log(`distance ${m.distance} locale ${m.locale.id}`);
m = matcher.match('es-MX');
console.log(`distance ${m.distance} locale ${m.locale.id}`);
distance 3 locale en_GB
distance 4 locale es-419