numeric-quantity
Advanced tools
Comparing version
@@ -176,3 +176,4 @@ "use strict"; | ||
allowTrailingInvalid: false, | ||
romanNumerals: false | ||
romanNumerals: false, | ||
bigIntOnOverflow: false | ||
}; | ||
@@ -196,3 +197,3 @@ | ||
var spaceThenSlashRegex = /^\s*\//; | ||
var numericQuantity = (quantity, options = defaultOptions) => { | ||
function numericQuantity(quantity, options = defaultOptions) { | ||
if (typeof quantity === "number" || typeof quantity === "bigint") { | ||
@@ -219,6 +220,12 @@ return quantity; | ||
const numberGroup1 = ng1temp.replace(/[,_]/g, ""); | ||
const numberGroup2 = ng2temp == null ? void 0 : ng2temp.replace(/[,_]/g, ""); | ||
const numberGroup2 = ng2temp?.replace(/[,_]/g, ""); | ||
if (!numberGroup1 && numberGroup2 && numberGroup2.startsWith(".")) { | ||
finalResult = 0; | ||
} else { | ||
if (opts.bigIntOnOverflow) { | ||
const asBigInt = dash ? BigInt(`-${numberGroup1}`) : BigInt(numberGroup1); | ||
if (asBigInt > BigInt(Number.MAX_SAFE_INTEGER) || asBigInt < BigInt(Number.MIN_SAFE_INTEGER)) { | ||
return asBigInt; | ||
} | ||
} | ||
finalResult = parseInt(numberGroup1); | ||
@@ -243,3 +250,3 @@ } | ||
return dash ? finalResult * -1 : finalResult; | ||
}; | ||
} | ||
// Annotate the CommonJS export names for ESM import in node: | ||
@@ -246,0 +253,0 @@ 0 && (module.exports = { |
@@ -1,2 +0,2 @@ | ||
"use strict";var g=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var D=(r,a)=>{for(var e in a)g(r,e,{get:a[e],enumerable:!0})},L=(r,a,e,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of F(a))!T.call(r,o)&&o!==e&&g(r,o,{get:()=>a[o],enumerable:!(s=h(a,o))||s.enumerable});return r};var _=r=>L(g({},"__esModule",{value:!0}),r);var b={};D(b,{defaultOptions:()=>R,numericQuantity:()=>O,numericRegex:()=>N,numericRegexWithTrailingInvalid:()=>x,parseRomanNumerals:()=>M,romanNumeralRegex:()=>y,romanNumeralUnicodeRegex:()=>X,romanNumeralUnicodeToAsciiMap:()=>d,romanNumeralValues:()=>c,vulgarFractionToAsciiMap:()=>I,vulgarFractionsRegex:()=>V});module.exports=_(b);var I={"\xBC":"1/4","\xBD":"1/2","\xBE":"3/4","\u2150":"1/7","\u2151":"1/9","\u2152":"1/10","\u2153":"1/3","\u2154":"2/3","\u2155":"1/5","\u2156":"2/5","\u2157":"3/5","\u2158":"4/5","\u2159":"1/6","\u215A":"5/6","\u215B":"1/8","\u215C":"3/8","\u215D":"5/8","\u215E":"7/8","\u215F":"1/"},N=/^(?=-?\s*\.\d|-?\s*\d)(-)?\s*((?:\d(?:[\d,_]*\d)?)*)(([eE][+-]?\d(?:[\d,_]*\d)?)?|\.\d(?:[\d,_]*\d)?([eE][+-]?\d(?:[\d,_]*\d)?)?|(\s+\d(?:[\d,_]*\d)?\s*)?\s*\/\s*\d(?:[\d,_]*\d)?)?$/,x=new RegExp(N.source.replace(/\$$/,"(?:\\s*[^\\.\\d\\/].*)?")),V=new RegExp(`(${Object.keys(I).join("|")})`),c={MMM:3e3,MM:2e3,M:1e3,CM:900,DCCC:800,DCC:700,DC:600,D:500,CD:400,CCC:300,CC:200,C:100,XC:90,LXXX:80,LXX:70,LX:60,L:50,XL:40,XXX:30,XX:20,XII:12,XI:11,X:10,IX:9,VIII:8,VII:7,VI:6,V:5,IV:4,III:3,II:2,I:1},d={"\u2160":"I","\u2161":"II","\u2162":"III","\u2163":"IV","\u2164":"V","\u2165":"VI","\u2166":"VII","\u2167":"VIII","\u2168":"IX","\u2169":"X","\u216A":"XI","\u216B":"XII","\u216C":"L","\u216D":"C","\u216E":"D","\u216F":"M","\u2170":"I","\u2171":"II","\u2172":"III","\u2173":"IV","\u2174":"V","\u2175":"VI","\u2176":"VII","\u2177":"VIII","\u2178":"IX","\u2179":"X","\u217A":"XI","\u217B":"XII","\u217C":"L","\u217D":"C","\u217E":"D","\u217F":"M"},X=new RegExp(`(${Object.keys(d).join("|")})`,"gi"),y=/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i,R={round:3,allowTrailingInvalid:!1,romanNumerals:!1};var M=r=>{let a=`${r}`.replace(X,(C,u)=>d[u]).toUpperCase(),e=y.exec(a);if(!e)return NaN;let[,s,o,l,p]=e;return(c[s]??0)+(c[o]??0)+(c[l]??0)+(c[p]??0)};var v=/^\s*\//,O=(r,a=R)=>{if(typeof r=="number"||typeof r=="bigint")return r;let e=NaN,s=`${r}`.replace(V,(i,m)=>` ${I[m]}`).replace("\u2044","/").trim();if(s.length===0)return NaN;let o={...R,...a},l=(o.allowTrailingInvalid?x:N).exec(s);if(!l)return o.romanNumerals?M(s):NaN;let[,p,C,u]=l,f=C.replace(/[,_]/g,""),n=u==null?void 0:u.replace(/[,_]/g,"");if(!f&&n&&n.startsWith(".")?e=0:e=parseInt(f),!n)return p?e*-1:e;let t=o.round===!1?NaN:parseFloat(`1e${Math.floor(Math.max(0,o.round))}`);if(n.startsWith(".")||n.startsWith("e")||n.startsWith("E")){let i=parseFloat(`${e}${n}`);e=isNaN(t)?i:Math.round(i*t)/t}else if(v.test(n)){let i=parseInt(f),m=parseInt(n.replace("/",""));e=isNaN(t)?i/m:Math.round(i*t/m)/t}else{let i=n.split("/"),[m,$]=i.map(A=>parseInt(A));e+=isNaN(t)?m/$:Math.round(m*t/$)/t}return p?e*-1:e};0&&(module.exports={defaultOptions,numericQuantity,numericRegex,numericRegexWithTrailingInvalid,parseRomanNumerals,romanNumeralRegex,romanNumeralUnicodeRegex,romanNumeralUnicodeToAsciiMap,romanNumeralValues,vulgarFractionToAsciiMap,vulgarFractionsRegex}); | ||
"use strict";var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var O=(n,r)=>{for(var e in r)f(n,e,{get:r[e],enumerable:!0})},F=(n,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of h(r))!E.call(n,t)&&t!==e&&f(n,t,{get:()=>r[t],enumerable:!(s=C(r,t))||s.enumerable});return n};var _=n=>F(f({},"__esModule",{value:!0}),n);var Q={};O(Q,{defaultOptions:()=>d,numericQuantity:()=>v,numericRegex:()=>N,numericRegexWithTrailingInvalid:()=>x,parseRomanNumerals:()=>b,romanNumeralRegex:()=>X,romanNumeralUnicodeRegex:()=>V,romanNumeralUnicodeToAsciiMap:()=>g,romanNumeralValues:()=>m,vulgarFractionToAsciiMap:()=>I,vulgarFractionsRegex:()=>y});module.exports=_(Q);var I={"\xBC":"1/4","\xBD":"1/2","\xBE":"3/4","\u2150":"1/7","\u2151":"1/9","\u2152":"1/10","\u2153":"1/3","\u2154":"2/3","\u2155":"1/5","\u2156":"2/5","\u2157":"3/5","\u2158":"4/5","\u2159":"1/6","\u215A":"5/6","\u215B":"1/8","\u215C":"3/8","\u215D":"5/8","\u215E":"7/8","\u215F":"1/"},N=/^(?=-?\s*\.\d|-?\s*\d)(-)?\s*((?:\d(?:[\d,_]*\d)?)*)(([eE][+-]?\d(?:[\d,_]*\d)?)?|\.\d(?:[\d,_]*\d)?([eE][+-]?\d(?:[\d,_]*\d)?)?|(\s+\d(?:[\d,_]*\d)?\s*)?\s*\/\s*\d(?:[\d,_]*\d)?)?$/,x=new RegExp(N.source.replace(/\$$/,"(?:\\s*[^\\.\\d\\/].*)?")),y=new RegExp(`(${Object.keys(I).join("|")})`),m={MMM:3e3,MM:2e3,M:1e3,CM:900,DCCC:800,DCC:700,DC:600,D:500,CD:400,CCC:300,CC:200,C:100,XC:90,LXXX:80,LXX:70,LX:60,L:50,XL:40,XXX:30,XX:20,XII:12,XI:11,X:10,IX:9,VIII:8,VII:7,VI:6,V:5,IV:4,III:3,II:2,I:1},g={"\u2160":"I","\u2161":"II","\u2162":"III","\u2163":"IV","\u2164":"V","\u2165":"VI","\u2166":"VII","\u2167":"VIII","\u2168":"IX","\u2169":"X","\u216A":"XI","\u216B":"XII","\u216C":"L","\u216D":"C","\u216E":"D","\u216F":"M","\u2170":"I","\u2171":"II","\u2172":"III","\u2173":"IV","\u2174":"V","\u2175":"VI","\u2176":"VII","\u2177":"VIII","\u2178":"IX","\u2179":"X","\u217A":"XI","\u217B":"XII","\u217C":"L","\u217D":"C","\u217E":"D","\u217F":"M"},V=new RegExp(`(${Object.keys(g).join("|")})`,"gi"),X=/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i,d={round:3,allowTrailingInvalid:!1,romanNumerals:!1,bigIntOnOverflow:!1};var b=n=>{let r=`${n}`.replace(V,(M,R)=>g[R]).toUpperCase(),e=X.exec(r);if(!e)return NaN;let[,s,t,p,c]=e;return(m[s]??0)+(m[t]??0)+(m[p]??0)+(m[c]??0)};var T=/^\s*\//;function v(n,r=d){if(typeof n=="number"||typeof n=="bigint")return n;let e=NaN,s=`${n}`.replace(y,(a,u)=>` ${I[u]}`).replace("\u2044","/").trim();if(s.length===0)return NaN;let t={...d,...r},p=(t.allowTrailingInvalid?x:N).exec(s);if(!p)return t.romanNumerals?b(s):NaN;let[,c,M,R]=p,l=M.replace(/[,_]/g,""),o=R?.replace(/[,_]/g,"");if(!l&&o&&o.startsWith("."))e=0;else{if(t.bigIntOnOverflow){let a=BigInt(c?`-${l}`:l);if(a>BigInt(Number.MAX_SAFE_INTEGER)||a<BigInt(Number.MIN_SAFE_INTEGER))return a}e=parseInt(l)}if(!o)return c?e*-1:e;let i=t.round===!1?NaN:parseFloat(`1e${Math.floor(Math.max(0,t.round))}`);if(o.startsWith(".")||o.startsWith("e")||o.startsWith("E")){let a=parseFloat(`${e}${o}`);e=isNaN(i)?a:Math.round(a*i)/i}else if(T.test(o)){let a=parseInt(l),u=parseInt(o.replace("/",""));e=isNaN(i)?a/u:Math.round(a*i/u)/i}else{let a=o.split("/"),[u,$]=a.map(A=>parseInt(A));e+=isNaN(i)?u/$:Math.round(u*i/$)/i}return c?e*-1:e}0&&(module.exports={defaultOptions,numericQuantity,numericRegex,numericRegexWithTrailingInvalid,parseRomanNumerals,romanNumeralRegex,romanNumeralUnicodeRegex,romanNumeralUnicodeToAsciiMap,romanNumeralValues,vulgarFractionToAsciiMap,vulgarFractionsRegex}); | ||
//# sourceMappingURL=numeric-quantity.cjs.production.js.map |
@@ -157,3 +157,4 @@ var __defProp = Object.defineProperty; | ||
allowTrailingInvalid: false, | ||
romanNumerals: false | ||
romanNumerals: false, | ||
bigIntOnOverflow: false | ||
}; | ||
@@ -178,3 +179,3 @@ | ||
var spaceThenSlashRegex = /^\s*\//; | ||
var numericQuantity = (quantity, options = defaultOptions) => { | ||
function numericQuantity(quantity, options = defaultOptions) { | ||
if (typeof quantity === "number" || typeof quantity === "bigint") { | ||
@@ -202,2 +203,8 @@ return quantity; | ||
} else { | ||
if (opts.bigIntOnOverflow) { | ||
const asBigInt = dash ? BigInt(`-${numberGroup1}`) : BigInt(numberGroup1); | ||
if (asBigInt > BigInt(Number.MAX_SAFE_INTEGER) || asBigInt < BigInt(Number.MIN_SAFE_INTEGER)) { | ||
return asBigInt; | ||
} | ||
} | ||
finalResult = parseInt(numberGroup1); | ||
@@ -222,3 +229,3 @@ } | ||
return dash ? finalResult * -1 : finalResult; | ||
}; | ||
} | ||
export { | ||
@@ -225,0 +232,0 @@ defaultOptions, |
@@ -1,2 +0,2 @@ | ||
"use strict";var NumericQuantity=(()=>{var g=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var T=Object.prototype.hasOwnProperty;var D=(r,a)=>{for(var e in a)g(r,e,{get:a[e],enumerable:!0})},L=(r,a,e,s)=>{if(a&&typeof a=="object"||typeof a=="function")for(let o of F(a))!T.call(r,o)&&o!==e&&g(r,o,{get:()=>a[o],enumerable:!(s=h(a,o))||s.enumerable});return r};var _=r=>L(g({},"__esModule",{value:!0}),r);var b={};D(b,{defaultOptions:()=>R,numericQuantity:()=>O,numericRegex:()=>N,numericRegexWithTrailingInvalid:()=>x,parseRomanNumerals:()=>M,romanNumeralRegex:()=>y,romanNumeralUnicodeRegex:()=>X,romanNumeralUnicodeToAsciiMap:()=>d,romanNumeralValues:()=>c,vulgarFractionToAsciiMap:()=>I,vulgarFractionsRegex:()=>V});var I={"\xBC":"1/4","\xBD":"1/2","\xBE":"3/4","\u2150":"1/7","\u2151":"1/9","\u2152":"1/10","\u2153":"1/3","\u2154":"2/3","\u2155":"1/5","\u2156":"2/5","\u2157":"3/5","\u2158":"4/5","\u2159":"1/6","\u215A":"5/6","\u215B":"1/8","\u215C":"3/8","\u215D":"5/8","\u215E":"7/8","\u215F":"1/"},N=/^(?=-?\s*\.\d|-?\s*\d)(-)?\s*((?:\d(?:[\d,_]*\d)?)*)(([eE][+-]?\d(?:[\d,_]*\d)?)?|\.\d(?:[\d,_]*\d)?([eE][+-]?\d(?:[\d,_]*\d)?)?|(\s+\d(?:[\d,_]*\d)?\s*)?\s*\/\s*\d(?:[\d,_]*\d)?)?$/,x=new RegExp(N.source.replace(/\$$/,"(?:\\s*[^\\.\\d\\/].*)?")),V=new RegExp(`(${Object.keys(I).join("|")})`),c={MMM:3e3,MM:2e3,M:1e3,CM:900,DCCC:800,DCC:700,DC:600,D:500,CD:400,CCC:300,CC:200,C:100,XC:90,LXXX:80,LXX:70,LX:60,L:50,XL:40,XXX:30,XX:20,XII:12,XI:11,X:10,IX:9,VIII:8,VII:7,VI:6,V:5,IV:4,III:3,II:2,I:1},d={"\u2160":"I","\u2161":"II","\u2162":"III","\u2163":"IV","\u2164":"V","\u2165":"VI","\u2166":"VII","\u2167":"VIII","\u2168":"IX","\u2169":"X","\u216A":"XI","\u216B":"XII","\u216C":"L","\u216D":"C","\u216E":"D","\u216F":"M","\u2170":"I","\u2171":"II","\u2172":"III","\u2173":"IV","\u2174":"V","\u2175":"VI","\u2176":"VII","\u2177":"VIII","\u2178":"IX","\u2179":"X","\u217A":"XI","\u217B":"XII","\u217C":"L","\u217D":"C","\u217E":"D","\u217F":"M"},X=new RegExp(`(${Object.keys(d).join("|")})`,"gi"),y=/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i,R={round:3,allowTrailingInvalid:!1,romanNumerals:!1};var M=r=>{let a=`${r}`.replace(X,(C,u)=>d[u]).toUpperCase(),e=y.exec(a);if(!e)return NaN;let[,s,o,l,p]=e;return(c[s]??0)+(c[o]??0)+(c[l]??0)+(c[p]??0)};var v=/^\s*\//,O=(r,a=R)=>{if(typeof r=="number"||typeof r=="bigint")return r;let e=NaN,s=`${r}`.replace(V,(i,m)=>` ${I[m]}`).replace("\u2044","/").trim();if(s.length===0)return NaN;let o={...R,...a},l=(o.allowTrailingInvalid?x:N).exec(s);if(!l)return o.romanNumerals?M(s):NaN;let[,p,C,u]=l,f=C.replace(/[,_]/g,""),n=u==null?void 0:u.replace(/[,_]/g,"");if(!f&&n&&n.startsWith(".")?e=0:e=parseInt(f),!n)return p?e*-1:e;let t=o.round===!1?NaN:parseFloat(`1e${Math.floor(Math.max(0,o.round))}`);if(n.startsWith(".")||n.startsWith("e")||n.startsWith("E")){let i=parseFloat(`${e}${n}`);e=isNaN(t)?i:Math.round(i*t)/t}else if(v.test(n)){let i=parseInt(f),m=parseInt(n.replace("/",""));e=isNaN(t)?i/m:Math.round(i*t/m)/t}else{let i=n.split("/"),[m,$]=i.map(A=>parseInt(A));e+=isNaN(t)?m/$:Math.round(m*t/$)/t}return p?e*-1:e};return _(b);})(); | ||
"use strict";var NumericQuantity=(()=>{var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var O=(n,r)=>{for(var e in r)f(n,e,{get:r[e],enumerable:!0})},F=(n,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of h(r))!E.call(n,t)&&t!==e&&f(n,t,{get:()=>r[t],enumerable:!(s=C(r,t))||s.enumerable});return n};var _=n=>F(f({},"__esModule",{value:!0}),n);var Q={};O(Q,{defaultOptions:()=>d,numericQuantity:()=>v,numericRegex:()=>N,numericRegexWithTrailingInvalid:()=>x,parseRomanNumerals:()=>b,romanNumeralRegex:()=>X,romanNumeralUnicodeRegex:()=>V,romanNumeralUnicodeToAsciiMap:()=>g,romanNumeralValues:()=>m,vulgarFractionToAsciiMap:()=>I,vulgarFractionsRegex:()=>y});var I={"\xBC":"1/4","\xBD":"1/2","\xBE":"3/4","\u2150":"1/7","\u2151":"1/9","\u2152":"1/10","\u2153":"1/3","\u2154":"2/3","\u2155":"1/5","\u2156":"2/5","\u2157":"3/5","\u2158":"4/5","\u2159":"1/6","\u215A":"5/6","\u215B":"1/8","\u215C":"3/8","\u215D":"5/8","\u215E":"7/8","\u215F":"1/"},N=/^(?=-?\s*\.\d|-?\s*\d)(-)?\s*((?:\d(?:[\d,_]*\d)?)*)(([eE][+-]?\d(?:[\d,_]*\d)?)?|\.\d(?:[\d,_]*\d)?([eE][+-]?\d(?:[\d,_]*\d)?)?|(\s+\d(?:[\d,_]*\d)?\s*)?\s*\/\s*\d(?:[\d,_]*\d)?)?$/,x=new RegExp(N.source.replace(/\$$/,"(?:\\s*[^\\.\\d\\/].*)?")),y=new RegExp(`(${Object.keys(I).join("|")})`),m={MMM:3e3,MM:2e3,M:1e3,CM:900,DCCC:800,DCC:700,DC:600,D:500,CD:400,CCC:300,CC:200,C:100,XC:90,LXXX:80,LXX:70,LX:60,L:50,XL:40,XXX:30,XX:20,XII:12,XI:11,X:10,IX:9,VIII:8,VII:7,VI:6,V:5,IV:4,III:3,II:2,I:1},g={"\u2160":"I","\u2161":"II","\u2162":"III","\u2163":"IV","\u2164":"V","\u2165":"VI","\u2166":"VII","\u2167":"VIII","\u2168":"IX","\u2169":"X","\u216A":"XI","\u216B":"XII","\u216C":"L","\u216D":"C","\u216E":"D","\u216F":"M","\u2170":"I","\u2171":"II","\u2172":"III","\u2173":"IV","\u2174":"V","\u2175":"VI","\u2176":"VII","\u2177":"VIII","\u2178":"IX","\u2179":"X","\u217A":"XI","\u217B":"XII","\u217C":"L","\u217D":"C","\u217E":"D","\u217F":"M"},V=new RegExp(`(${Object.keys(g).join("|")})`,"gi"),X=/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i,d={round:3,allowTrailingInvalid:!1,romanNumerals:!1,bigIntOnOverflow:!1};var b=n=>{let r=`${n}`.replace(V,(M,R)=>g[R]).toUpperCase(),e=X.exec(r);if(!e)return NaN;let[,s,t,p,c]=e;return(m[s]??0)+(m[t]??0)+(m[p]??0)+(m[c]??0)};var T=/^\s*\//;function v(n,r=d){if(typeof n=="number"||typeof n=="bigint")return n;let e=NaN,s=`${n}`.replace(y,(a,u)=>` ${I[u]}`).replace("\u2044","/").trim();if(s.length===0)return NaN;let t={...d,...r},p=(t.allowTrailingInvalid?x:N).exec(s);if(!p)return t.romanNumerals?b(s):NaN;let[,c,M,R]=p,l=M.replace(/[,_]/g,""),o=R?.replace(/[,_]/g,"");if(!l&&o&&o.startsWith("."))e=0;else{if(t.bigIntOnOverflow){let a=BigInt(c?`-${l}`:l);if(a>BigInt(Number.MAX_SAFE_INTEGER)||a<BigInt(Number.MIN_SAFE_INTEGER))return a}e=parseInt(l)}if(!o)return c?e*-1:e;let i=t.round===!1?NaN:parseFloat(`1e${Math.floor(Math.max(0,t.round))}`);if(o.startsWith(".")||o.startsWith("e")||o.startsWith("E")){let a=parseFloat(`${e}${o}`);e=isNaN(i)?a:Math.round(a*i)/i}else if(T.test(o)){let a=parseInt(l),u=parseInt(o.replace("/",""));e=isNaN(i)?a/u:Math.round(a*i/u)/i}else{let a=o.split("/"),[u,$]=a.map(A=>parseInt(A));e+=isNaN(i)?u/$:Math.round(u*i/$)/i}return c?e*-1:e}return _(Q);})(); | ||
//# sourceMappingURL=numeric-quantity.umd.min.js.map |
{ | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
@@ -16,7 +16,7 @@ "name": "numeric-quantity", | ||
"import": { | ||
"types": "./dist/numeric-quantity.d.mts", | ||
"types": "./dist/types-esm/index.d.mts", | ||
"default": "./dist/numeric-quantity.mjs" | ||
}, | ||
"require": { | ||
"types": "./dist/cjs/numeric-quantity.cjs.development.d.ts", | ||
"types": "./dist/types/index.d.ts", | ||
"default": "./dist/cjs/index.js" | ||
@@ -26,3 +26,3 @@ } | ||
}, | ||
"types": "./dist/cjs/numeric-quantity.cjs.production.d.ts", | ||
"types": "./dist/types/index.d.ts", | ||
"unpkg": "./dist/numeric-quantity.umd.min.js", | ||
@@ -47,21 +47,23 @@ "bugs": { | ||
"scripts": { | ||
"start": "bun --hot ./server.ts", | ||
"build": "tsup", | ||
"docs": "bunx typedoc", | ||
"start": "bun --hot ./main.html", | ||
"build": "bunx --bun tsup", | ||
"docs": "typedoc", | ||
"test": "bun test", | ||
"watch": "bun test --watch", | ||
"lint": "bunx oxlint@latest --format=github", | ||
"publish:npm": "np", | ||
"pretty-print": "bunx prettier --write *.{mjs,ts,json} src/*.*" | ||
"codesandbox-ci": "bash .codesandbox/ci.sh", | ||
"pretty-print": "prettier --write '*.{html,json,ts}' 'src/*.*'" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.11.2", | ||
"@types/web": "^0.0.135", | ||
"bun-types": "^1.0.22", | ||
"np": "^9.2.0", | ||
"open": "^10.0.3", | ||
"prettier": "^3.2.2", | ||
"prettier-plugin-organize-imports": "^3.2.4", | ||
"tsup": "^8.0.1", | ||
"typedoc": "^0.25.7", | ||
"typescript": "^5.3.3" | ||
"@jakeboone02/generate-dts": "0.1.1", | ||
"@types/bun": "^1.2.8", | ||
"@types/node": "^22.13.14", | ||
"@types/web": "^0.0.214", | ||
"np": "^10.2.0", | ||
"prettier": "3.5.3", | ||
"prettier-plugin-organize-imports": "4.1.0", | ||
"tsup": "^8.4.0", | ||
"typedoc": "^0.28.1", | ||
"typescript": "^5.8.2" | ||
}, | ||
@@ -68,0 +70,0 @@ "engines": { |
@@ -16,2 +16,3 @@ [![npm][badge-npm]](https://www.npmjs.com/package/numeric-quantity) | ||
- To parse Roman numerals like `'MCCXIV'` or `'Ⅻ'`, pass `{ romanNumerals: true }` as the second argument or call `parseRomanNumerals` directly. | ||
- To produce `bigint` values when the input represents an integer that would exceeds the boundaries of `number`, pass `{ bigIntOnOverflow: true }` as the second argument. | ||
- Results will be rounded to three decimal places by default. To avoid rounding, pass `{ round: false }` as the second argument. To round to a different number of decimal places, assign that number to the `round` option (`{ round: 5 }` will round to five decimal places). | ||
@@ -18,0 +19,0 @@ - Returns `NaN` if the provided string does not resemble a number. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
28
33.33%57
1.79%151554
-10.45%906
-22.96%