Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
currency-to-locale
Advanced tools
Converts currency codes to locale identifiers following format specified in IETF BCP 47 standard
This project was built and is maintained by Laura Gates, https://github.com/laurapg1214.
Feel free to reach out with any questions or contributions!
Converts currency codes to locale identifiers following format specified in IETF BCP 47 standard, comprised of a two-letter ISO 639-1 language code and ISO 3166-1 alpha-2 country code.
For currency codes with multiple locales/language codes, defaults have been selected.
Currency codes initially compiled using Frankfurter's https://api.frankfurter.app/currencies.
Additional currency code and locale ID additions are welcome; please see "Contributing" section below.
Install via npm:
npm install currency-to-locale
This will add the package to your project's dependencies.
To use the currencyToLocale
function in your project, import it as follows:
import currencyToLocale from 'currency-to-locale';
Function usage: currencyToLocale
currencyToLocale(currencyCode, languageCode)
The currencyToLocale
function accepts two arguments:
It returns the corresponding locale identifier (e.g. "en-US", "de-DE").
Examples
// Example 1: Simple usage const locale = currencyToLocale('USD'); // returns 'en-US'
// Example 2: Currency code with multiple locales, returns locale based on language code provided const locale = currencyToLocale('EUR', 'fr'); // returns 'fr-FR'
// Example 3: Currency code with multiple locales, no language code provided (default locale returned) console.log("EUR with no language code:", currencyToLocale('EUR')); // returns 'de-DE'
// Example 4: Invalid or not-found currency code const locale = currencyToLocale('XYZ'); // returns 'Currency code not found.' const locale = currencyToLocale(1); // returns 'Please provide a valid currency code.'
Run examples
To see these and additional examples in action, run the following command:
node examples/examples.js
This will execute the example script provided in the examples
folder and show the output.
I welcome contributions! If you'd like to improve or add to this project, please follow these steps:
feature-xyz
or bugfix-123
).Code of Conduct Please be respectful and follow the Contributor Covenant Code of Conduct.
I appreciate your contributions and look forward to collaborating with you!
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Converts currency codes to locale identifiers following format specified in IETF BCP 47 standard
The npm package currency-to-locale receives a total of 391 weekly downloads. As such, currency-to-locale popularity was classified as not popular.
We found that currency-to-locale 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.