Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Simple number, currency and date formatters based on the Internationalization API
Simple number, currency, type and date formatters based on the Internationalization API.
npm install --save vi18n // or --save-dev
import VI18N from 'vi18n';
const nl = new VI18N(); // Default locale is Dutch with the Euro as currency
const uk = new VI18N('en-GB', 'GBP');
nl.formatNumber(12.50); // '12,50'
uk.formatNumber(12.50); // '12.50'
nl.formatCurrency(12.50); // '€ 12,50'
uk.formatCurrency(12.50); // '£12.50'
// In another currency
nl.formatCurrency(12.50, { currency: 'JPY' }); // 'JP¥ 12,50'
uk.formatCurrency(12.50, { currency: 'JPY' }); // '¥12.50'
// Or without decimals
nl.formatCurrency(12.50, { minimumFractionDigits: 0, maximumFractionDigits: 0 }); // '€ 12'
uk.formatCurrency(12.50, { currency: 'JPY', minimumFractionDigits: 0, maximumFractionDigits: 0 }); // '¥12'
nl.formatPercent(0.75); // '75%'
uk.formatPercent(0.75); // '75%'
var date = new Date();
nl.formatDate(date); // '2-9-2015'
uk.formatDate(date); // '02/09/2015'
nl.formatTime(date); // '12:38:09'
uk.formatTime(date); // '12:38:09'
nl.getDecimalSeparator(); // ','
nl.getThousandSeparator(); // '.'
// Possible representations are 'narrow', 'short' or 'long' (default).
uk.getMonths() // [ 'January', 'February', 'March', etc. ]
uk.getMonths('short') // [ 'Jan', 'Feb', 'Mar', etc. ]
uk.getMonths('narrow') // [ 'J', 'F', 'M', etc. ]
uk.getDays() // [ 'Sunday', 'Monday', 'Tuesday', etc. ]
uk.getDays('short') // [ 'Sun', 'Mon', 'Tue', etc. ]
uk.getDays('narrow') // [ 'S', 'M', 'T', etc. ]
// Get locale instances
var dutch = VI18N.getLocale('nl-NL');
// Check for native browser support or the presence of a polyfill.
VI18N.isSupported();
MIT © VI Company
FAQs
Simple number, currency and date formatters based on the Internationalization API
The npm package vi18n receives a total of 52 weekly downloads. As such, vi18n popularity was classified as not popular.
We found that vi18n demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.