
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
js-currency-format
Advanced tools
This is a tool for intl currency and percent formatting.the special feature is that it can be uesd in event listenner function onChange of inputNumber
this is a tool that can format and unformat currency and percent.the special feature is that it can be uesd in event listenner function onChange of inputNumber;
npm i js-currency-format
import CurrencyFormatter from 'js-currency-format';
const currencyFormatter = new CurrencyFormatter({
locales: 'zh-CN',
precision: 5,
currency: 'USD',
style: 'currency',
// currencyDisplay: 'code'
});
const b = a.format(10000);
console.log(b);
console.log(a.unformat(b));
if you want to know more details of values from format and unformat, you can see file 'test/index.test.ts';
CurrencyFormatter.prototype.parseThousandthsSymbol: (locales?: string | string[]) => string: it can get thousandths symbol form the localesCurrencyFormatter.prototype.parseDecimalSymbol: (locales?: string | string[]) => string: it can get decimal symbol form the localesCurrencyFormatter.prototype.parseStyleSymbol(options?: CurrencyFormatterProps) => [styleSymbolPosition, string]: it can get style symbol form the CurrencyFormatterPropsCurrencyFormatter.prototype.format: (formatVal: number | string, localesOrOption?: string | string[], options?: CurrencyFormatterProps) => stringCurrencyFormatter.prototype.unformat: (string: number | string, locales?: string | string[], options?: CurrencyFormatterProps & {isNumber: boolean}) => number | string Number.prototype.toLocaleString.Maybe you can get some informations from this page of MDN;
// constructor
interface CurrencyFormatterProps {
locales: string | string[],
minimumIntegerDigits?: number,
precision?: number,
useGrouping?: boolean,
localeMatcher?: 'lookup' | 'best fit',
formatter?: typeof CurrencyFormatter.formatter,
style?: 'decimal' | 'currency' | 'percent',
currency?: string,
currencyDisplay?: 'symbol' | 'code' | 'name',
}
//options of format
interface optionsofformat {
minimumIntegerDigits?: number,
precision?: number,
useGrouping?: boolean,
localeMatcher?: 'lookup' | 'best fit',
style?: 'decimal' | 'currency' | 'percent',
currency?: string,
currencyDisplay?: 'symbol' | 'code' | 'name',
}
FAQs
This is a tool for intl currency and percent formatting.the special feature is that it can be uesd in event listenner function onChange of inputNumber
The npm package js-currency-format receives a total of 23 weekly downloads. As such, js-currency-format popularity was classified as not popular.
We found that js-currency-format 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.