Socket
Socket
Sign inDemoInstall

format-money-js

Package Overview
Dependencies
104
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.3 to 1.5.5

16

dist/format-money.d.ts
/*!
* format-money-js v1.5.3
* format-money-js v1.5.5
* (c) 2020-2022 Yurii Derevych

@@ -17,8 +17,8 @@ * Sponsored by https://currencyrate.today/

export interface FormatMoneyParse {
source?: number;
negative?: boolean;
fullAmount?: string;
amount?: string;
decimals?: string;
symbol?: string;
source: number;
negative: boolean;
fullAmount: string;
amount: string;
decimals: string;
symbol: string;
}

@@ -30,4 +30,4 @@ export declare class FormatMoney {

constructor(options?: FormatMoneyOptions);
from: (number: number, options?: FormatMoneyOptions | {}, parse?: boolean) => string | number | FormatMoneyParse | undefined;
from: (number: number, options?: FormatMoneyOptions | {}, parse?: boolean) => FormatMoneyParse | string | undefined;
un: (value: (string | number), options: FormatMoneyOptions) => number | undefined;
}
"use strict";
/*!
* format-money-js v1.5.3
* format-money-js v1.5.5
* (c) 2020-2022 Yurii Derevych

@@ -13,3 +13,3 @@ * Sponsored by https://currencyrate.today/

this.options = options;
this.version = '1.5.2';
this.version = '1.5.5';
this.defaults = {

@@ -16,0 +16,0 @@ grouping: true,

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FormatMoney=void 0;class FormatMoney{constructor(e){this.options=e,this.version="1.5.2",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,symbol:"",append:!1,leadZeros:!0},this.from=((e,t={},s=!1)=>{const o=Object.assign(Object.assign({},this.options),t);if("number"!=typeof e)return;const i=e<0?"-":"";let n,r,a,l,c,p,m;if(n=Math.abs(e).toFixed(o.decimals),!o.leadZeros){n=parseFloat(n).toString()}if(a=(r=n.split("."))[0],l=r.length>1?o.decimalPoint+r[1]:"",o.grouping){c="";for(let e=0,t=a.length;e<t;e+=1)0!==e&&e%3==0&&(c=o.separator+c),c=a[t-e-1]+c;a=c}return p=m="",o.append?m=o.symbol:p=o.symbol,s?{source:e,negative:e<0,fullAmount:a+l,amount:a,decimals:l,symbol:o.symbol}:i+p+a+l+m}),this.un=((e,t)=>{const s=Object.assign(Object.assign({},this.options),t);if("number"==typeof e)return e;if("string"!=typeof e)return;const o=new RegExp(`[^0-9-${s.decimalPoint}]`,"g"),i=parseFloat(e.replace(/\((?=\d+)(.*)\)/,"-$1").replace(o,"").replace(`${s.decimalPoint}`,"."));return isNaN(i)?0:i}),this.options=Object.assign(Object.assign({},this.defaults),e)}}exports.FormatMoney=FormatMoney;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FormatMoney=void 0;class FormatMoney{constructor(e){this.options=e,this.version="1.5.5",this.defaults={grouping:!0,separator:",",decimalPoint:".",decimals:0,symbol:"",append:!1,leadZeros:!0},this.from=((e,t={},s=!1)=>{const o=Object.assign(Object.assign({},this.options),t);if("number"!=typeof e)return;const i=e<0?"-":"";let n,r,a,l,c,p,m;if(n=Math.abs(e).toFixed(o.decimals),!o.leadZeros){n=parseFloat(n).toString()}if(a=(r=n.split("."))[0],l=r.length>1?o.decimalPoint+r[1]:"",o.grouping){c="";for(let e=0,t=a.length;e<t;e+=1)0!==e&&e%3==0&&(c=o.separator+c),c=a[t-e-1]+c;a=c}return p=m="",o.append?m=o.symbol:p=o.symbol,s?{source:e,negative:e<0,fullAmount:a+l,amount:a,decimals:l,symbol:o.symbol}:i+p+a+l+m}),this.un=((e,t)=>{const s=Object.assign(Object.assign({},this.options),t);if("number"==typeof e)return e;if("string"!=typeof e)return;const o=new RegExp(`[^0-9-${s.decimalPoint}]`,"g"),i=parseFloat(e.replace(/\((?=\d+)(.*)\)/,"-$1").replace(o,"").replace(`${s.decimalPoint}`,"."));return isNaN(i)?0:i}),this.options=Object.assign(Object.assign({},this.defaults),e)}}exports.FormatMoney=FormatMoney;
{
"name": "format-money-js",
"description": "Zero dependency tiny JavaScript library (1kB bytes) by CurrencyRate.today, providing simple way and advanced number, money and currency formatting and removes all formatting/cruft and returns the raw float value.",
"version": "1.5.3",
"version": "1.5.5",
"license": "BSD-2-Clause",

@@ -6,0 +6,0 @@ "main": "./dist/format-money.js",

/*!
* format-money-js v1.5.3
* format-money-js v1.5.5
* (c) 2020-2022 Yurii Derevych

@@ -19,8 +19,8 @@ * Sponsored by https://currencyrate.today/

export interface FormatMoneyParse { // Parse
source?: number;
negative?: boolean;
fullAmount?: string;
amount?: string;
decimals?: string;
symbol?: string;
source: number;
negative: boolean;
fullAmount: string;
amount: string;
decimals: string;
symbol: string;
}

@@ -30,3 +30,3 @@

version = '1.5.2';
version = '1.5.5';
private defaults: FormatMoneyOptions = {

@@ -53,3 +53,3 @@ grouping: true,

options: FormatMoneyOptions | {} = {},
parse: boolean = false): string | number | FormatMoneyParse | undefined => {
parse: boolean = false): FormatMoneyParse | string | undefined => {
const opt = {

@@ -109,3 +109,3 @@ ...this.options,

un = (value: (string | number), options: FormatMoneyOptions): number| undefined => {
un = (value: (string | number), options: FormatMoneyOptions): number | undefined => {
const opt = {

@@ -112,0 +112,0 @@ ...this.options,

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc