Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@formatjs/intl-localematcher
Advanced tools
The @formatjs/intl-localematcher package is designed to help with locale matching based on the Best Fit Matcher algorithm as specified by the ECMAScript Internationalization API. It allows developers to determine the best available locale for their application based on a list of desired locales and a list of supported locales. This can be particularly useful in internationalization (i18n) efforts where applications need to gracefully handle multiple languages and regional differences.
Locale Matching
This feature allows you to match a list of desired locales against a list of supported locales to find the best match. It uses the Best Fit Matcher algorithm to determine the most appropriate locale for the user.
"use strict";
const {getCanonicalLocales, match} = require('@formatjs/intl-localematcher');
const supportedLocales = ['en-US', 'fr-FR', 'es-ES'];
const desiredLocales = ['en-GB', 'en'];
const bestMatch = match(desiredLocales, supportedLocales);
console.log(bestMatch); // 'en-US'
The 'locale' package provides similar functionalities for locale detection and negotiation. It can parse, normalize, and match locales using different strategies. Compared to @formatjs/intl-localematcher, 'locale' offers a broader set of features for handling locales but might not specifically implement the Best Fit Matcher algorithm as defined by ECMAScript.
This package is designed to parse the Accept-Language header from an HTTP request and match it against a list of supported languages. While it serves a similar purpose in determining the best language for the user, it is more focused on the context of HTTP requests and does not directly implement the ECMAScript Internationalization API's Best Fit Matcher algorithm.
We've migrated the docs to https://formatjs.github.io/docs/polyfills/intl-localematcher.
FAQs
Intl.LocaleMatcher ponyfill
The npm package @formatjs/intl-localematcher receives a total of 4,209,679 weekly downloads. As such, @formatjs/intl-localematcher popularity was classified as popular.
We found that @formatjs/intl-localematcher demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.