All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.utils.currencyFormat.js.map Maven / Gradle / Ivy

Go to download

A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.

There is a newer version: 4.12.3
Show newest version
{"version":3,"file":"currencyFormat.js","names":["dayjs","getAmountWithSymbol","amount","options","formatter","Intl","NumberFormat","locale","_objectSpread","format","Number","currencyFormat","withAmount","arguments","length","undefined","minimumFractionDigits","style","withSymbol","currency","withCode","concat","withSymbolAndCode"],"sources":["../../src/utils/currencyFormat.js"],"sourcesContent":["import dayjs from \"dayjs\";\n\nconst getAmountWithSymbol = (amount, options) => {\n  const formatter = new Intl.NumberFormat(dayjs.locale(), {\n    ...options,\n  });\n\n  return formatter.format(Number(amount));\n};\n\nexport const currencyFormat = {\n  withAmount: (amount, options = { minimumFractionDigits: 2 }) =>\n    getAmountWithSymbol(amount, {\n      style: undefined,\n      ...options,\n    }), // 1000, { maximumFractionDigits: 1 } => 1,000.0\n  withSymbol: (amount, currency, options) =>\n    getAmountWithSymbol(amount, {\n      ...options,\n      style: \"currency\",\n      currency,\n    }), // 1000, \"INR\", { maximumFractionDigits: 0 } => ₹1,000\n  withCode: (amount, currency, options = { minimumFractionDigits: 2 }) =>\n    `${getAmountWithSymbol(amount, {\n      ...options,\n      style: undefined,\n    })} ${currency}`, // 1000, \"USD\" => 1,000.00 USD\n  withSymbolAndCode: (amount, currency, options) =>\n    `${getAmountWithSymbol(amount, {\n      ...options,\n      style: \"currency\",\n      currency,\n    })} ${currency}`, // 1000, \"INR\", { maximumFractionDigits: 0 } => ₹1,000 INR\n};\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,MAAM,EAAEC,OAAO,EAAK;EAC/C,IAAMC,SAAS,GAAG,IAAIC,IAAI,CAACC,YAAY,CAACN,KAAK,CAACO,MAAM,EAAE,EAAAC,aAAA,KACjDL,OAAO,EACV;EAEF,O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