New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@phensley/locale-matcher

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@phensley/locale-matcher

Implements CLDR enhanced language matching

  • 1.2.16
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7K
decreased by-7.1%
Maintainers
1
Weekly downloads
 
Created
Source

@phensley/locale-matcher

@phensley/locale-matcher min+gzip

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';

// Add supported locales to matcher
const matcher = new LocaleMatcher('en, en_GB, zh, pt_AR, es-419');
let m: LocaleMatch;

// Query desired locales to find the nearest match
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

FAQs

Package last updated on 30 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc