@tolki/num 2.0.5 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -62,7 +62,7 @@ However, if you are working on a backend project where bundle size is not a conc
62
62
 
63
63
  These are the number utilities that can be used independently as single functions.
64
64
 
65
- [abbreviate](#abbreviate) [clamp](#clamp) [currency](#currency) [defaultCurrency](#defaultcurrency) [defaultLocale](#defaultlocale) [fileSize](#filesize) [forHumans](#forhumans) [format](#format) [minutesToHuman](#minutestohuman) [ordinal](#ordinal) [pairs](#pairs) [parseFloat](#parsefloat) [parseInt](#parseint) [percentage](#percentage) [spell](#spell) [spellOrdinal](#spellordinal) [secondsToHuman](#secondstohuman) [trim](#trim) [useLocale](#uselocale) [withLocale](#withlocale) [useCurrency](#usecurrency) [withCurrency](#withcurrency)
65
+ [abbreviate](#abbreviate) [clamp](#clamp) [currency](#currency) [defaultCurrency](#defaultcurrency) [defaultLocale](#defaultlocale) [fileSize](#filesize) [forHumans](#forhumans) [format](#format) [minutesToHuman](#minutestohuman) [ordinal](#ordinal) [pairs](#pairs) [parse](#parse) [parseFloat](#parsefloat) [parseInt](#parseint) [percentage](#percentage) [spell](#spell) [spellOrdinal](#spellordinal) [secondsToHuman](#secondstohuman) [trim](#trim) [useLocale](#uselocale) [withLocale](#withlocale) [useCurrency](#usecurrency) [withCurrency](#withcurrency)
66
66
 
67
67
  ### Number Utilities Details
68
68
 
@@ -278,6 +278,22 @@ const result2 = pairs(25, 10, 0, 0);
278
278
  // result2 is [[0, 10], [10, 20], [20, 25]]
279
279
  ```
280
280
 
281
+ #### parse
282
+
283
+ Parse a localized numeric string into a number.
284
+
285
+ ```javascript
286
+ import { parse } from "@tolki/num";
287
+
288
+ const result = parse("10,123", "en");
289
+
290
+ // result is 10123
291
+
292
+ const result2 = parse("10,123", "fr");
293
+
294
+ // result2 is 10.123
295
+ ```
296
+
281
297
  #### parseInt
282
298
 
283
299
  Parse a string into an integer according to the specified locale.
package/dist/num.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"num.d.ts","sourceRoot":"","sources":["../src/num.ts"],"names":[],"mappings":"AAUA;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACtB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAU,EACrB,YAAY,GAAE,MAAM,GAAG,IAAW,GACnC,MAAM,GAAG,KAAK,CAEhB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAClB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,MAAM,GAAG,IAAW,EAC/B,YAAY,GAAE,MAAM,GAAG,IAAW,EAClC,MAAM,GAAE,MAAM,GAAG,IAAW,GAC7B,MAAM,GAAG,KAAK,CAmBhB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CA2DzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CACpB,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,MAAM,GAAG,IAAW,GAC7B,MAAM,GAAG,KAAK,CAQhB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACtB,KAAK,EAAE,MAAM,EACb,MAAM,GAAE,MAAM,GAAG,IAAW,GAC7B,MAAM,GAAG,KAAK,CAEhB;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,CA2C3E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,SAAS,GAAE,MAAU,EACrB,YAAY,GAAE,MAAM,GAAG,IAAW,EAClC,MAAM,GAAE,MAAM,GAAG,IAAW,GAC7B,MAAM,GAAG,KAAK,CAqBhB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,C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BAAgB,eAAe,IAAI,MAAM,CAExC"}
package/dist/num.js CHANGED
@@ -13,27 +13,27 @@ function f(t, n = null, e = null, r = null) {
13
13
  function y(t, n = null) {
14
14
  n = n ?? p;
15
15
  const r = new Intl.NumberFormat(n).formatToParts(12345.6), o = /* @__PURE__ */ new Set();
16
- let s = ".";
16
+ let l = ".";
17
17
  for (const i of r)
18
- i.type === "group" ? o.add(i.value) : i.type === "decimal" && (s = i.value);
18
+ i.type === "group" ? o.add(i.value) : i.type === "decimal" && (l = i.value);
19
19
  const u = [" ", " ", " "];
20
20
  for (const i of u) o.add(i);
21
- let l = t;
21
+ let s = t;
22
22
  for (const i of o) {
23
23
  const c = new RegExp(
24
24
  i.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"),
25
25
  "g"
26
26
  );
27
- l = l.replace(c, "");
27
+ s = s.replace(c, "");
28
28
  }
29
- if (s !== ".") {
29
+ if (l !== ".") {
30
30
  const i = new RegExp(
31
- s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"),
31
+ l.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"),
32
32
  "g"
33
- ), c = l.lastIndexOf(s);
34
- c !== -1 && (l = l.slice(0, c).replace(i, "") + "." + l.slice(c + s.length));
33
+ ), c = s.lastIndexOf(l);
34
+ c !== -1 && (s = s.slice(0, c).replace(i, "") + "." + s.slice(c + l.length));
35
35
  }
36
- return l = l.replace(/[\s\u00A0\u202F\u2009]+/g, "").trim(), globalThis.Number(l);
36
+ return s = s.replace(/[\s\u00A0\u202F\u2009]+/g, "").trim(), globalThis.Number(s);
37
37
  }
38
38
  function E(t, n = null) {
39
39
  const e = y(t, n);
@@ -45,14 +45,14 @@ function B(t, n = null) {
45
45
  function O(t, n = null) {
46
46
  const e = n ?? p;
47
47
  try {
48
- const o = new Intl.PluralRules(e, { type: "ordinal" }).select(t), s = String(e.split("-")[0]), u = {
48
+ const o = new Intl.PluralRules(e, { type: "ordinal" }).select(t), l = String(e.split("-")[0]), u = {
49
49
  one: "st",
50
50
  two: "nd",
51
51
  few: "rd",
52
52
  other: "th"
53
53
  }, m = {
54
54
  en: u
55
- }[s] ?? u, i = m[o] ?? m.other;
55
+ }[l] ?? u, i = m[o] ?? m.other;
56
56
  return `${t}${i}`;
57
57
  } catch {
58
58
  const r = Math.abs(t), o = r % 100;
@@ -71,19 +71,19 @@ function O(t, n = null) {
71
71
  }
72
72
  }
73
73
  function I(t, n = 0, e = null, r = null) {
74
- const o = r ?? p, s = typeof t == "string" ? y(t, o) : t, u = {
74
+ const o = r ?? p, l = typeof t == "string" ? y(t, o) : t, u = {
75
75
  style: "percent",
76
76
  useGrouping: !0
77
77
  };
78
- return e != null ? (u.maximumFractionDigits = e, u.minimumFractionDigits = 0) : (u.minimumFractionDigits = n, u.maximumFractionDigits = n), new Intl.NumberFormat(o, u).format(s / 100);
78
+ return e != null ? (u.maximumFractionDigits = e, u.minimumFractionDigits = 0) : (u.minimumFractionDigits = n, u.maximumFractionDigits = n), new Intl.NumberFormat(o, u).format(l / 100);
79
79
  }
80
80
  function T(t, n = "", e = null, r = null) {
81
- const o = e ?? p, s = typeof t == "string" ? y(t, o) : t, l = {
81
+ const o = e ?? p, l = typeof t == "string" ? y(t, o) : t, s = {
82
82
  style: "currency",
83
83
  currency: n && n.length ? n : $,
84
84
  useGrouping: !0
85
85
  };
86
- return r != null && (l.minimumFractionDigits = r, l.maximumFractionDigits = r), new Intl.NumberFormat(o, l).format(s);
86
+ return r != null && (s.minimumFractionDigits = r, s.maximumFractionDigits = r), new Intl.NumberFormat(o, s).format(l);
87
87
  }
88
88
  function R(t, n = 0, e = null) {
89
89
  let r = typeof t == "string" ? Number(t) : t;
@@ -98,14 +98,14 @@ function R(t, n = 0, e = null) {
98
98
  "EB",
99
99
  "ZB",
100
100
  "YB"
101
- ], s = o.length;
101
+ ], l = o.length;
102
102
  let u = 0;
103
- for (; r / 1024 > 0.9 && u < s - 1; )
103
+ for (; Math.abs(r) / 1024 > 0.9 && u < l - 1; )
104
104
  r /= 1024, u++;
105
105
  return `${f(r, n, e)} ${o[u]}`;
106
106
  }
107
107
  function S(t, n = 0, e = null, r = !1) {
108
- return b(
108
+ return N(
109
109
  t,
110
110
  n,
111
111
  e,
@@ -118,7 +118,7 @@ function S(t, n = 0, e = null, r = !1) {
118
118
  }
119
119
  );
120
120
  }
121
- function b(t, n = 0, e = null, r = {}) {
121
+ function N(t, n = 0, e = null, r = {}) {
122
122
  if (Object.keys(r).length === 0 && (r = {
123
123
  3: "K",
124
124
  6: "M",
@@ -128,7 +128,7 @@ function b(t, n = 0, e = null, r = {}) {
128
128
  }), Number(t) === 0)
129
129
  return n > 0 ? f(0, n, e) : "0";
130
130
  if (t < 0)
131
- return `-${b(
131
+ return `-${N(
132
132
  Math.abs(t),
133
133
  n,
134
134
  e,
@@ -136,7 +136,7 @@ function b(t, n = 0, e = null, r = {}) {
136
136
  )}`;
137
137
  if (t >= 1e15) {
138
138
  const i = Object.keys(r).map((a) => Number(a)).filter((a) => !Number.isNaN(a)).sort((a, d) => a - d), c = i[i.length - 1], h = r[c];
139
- return `${b(
139
+ return `${N(
140
140
  t / 1e15,
141
141
  n,
142
142
  e,
@@ -144,52 +144,55 @@ function b(t, n = 0, e = null, r = {}) {
144
144
  )}${h}`.trim();
145
145
  }
146
146
  const o = Math.floor(Math.log10(t));
147
- let s = o - o % 3;
148
- const u = t / Math.pow(10, s);
149
- let l;
147
+ let l = o - o % 3;
148
+ const u = t / Math.pow(10, l);
149
+ let s;
150
150
  if (e != null)
151
- l = f(u, null, e);
151
+ s = f(u, null, e);
152
152
  else if (n > 0)
153
- l = f(u, n, null);
153
+ s = f(u, n, null);
154
154
  else {
155
155
  const i = Math.abs(t);
156
- l = s === 3 && u < 10 && i % 10 === 0 ? f(u, null, 1) : f(u, 0, null);
156
+ s = l === 3 && u < 10 && i % 10 === 0 ? f(u, null, 1) : f(u, 0, null);
157
157
  }
158
- if (y(l) >= 1e3 && r[s + 3] !== void 0) {
159
- s += 3;
158
+ if (y(s) >= 1e3 && r[l + 3] !== void 0) {
159
+ l += 3;
160
160
  const i = u / 1e3;
161
- e != null ? l = f(i, null, e) : n > 0 ? l = f(i, n, null) : l = f(i, 0, null);
161
+ e != null ? s = f(i, null, e) : n > 0 ? s = f(i, n, null) : s = f(i, 0, null);
162
162
  }
163
- const m = r[s] ?? "";
164
- return `${l}${m}`.trim();
163
+ const m = r[l] ?? "";
164
+ return `${s}${m}`.trim();
165
165
  }
166
166
  function G(t, n, e) {
167
167
  return Math.min(Math.max(t, n), e);
168
168
  }
169
169
  function H(t, n, e = 0, r = 1) {
170
+ if (n === 0)
171
+ throw new Error("The $by argument must not be zero.");
172
+ n = Math.abs(n);
170
173
  const o = [];
171
- for (let s = e; s < t; s += n) {
172
- let u = s + n - r;
173
- u > t && (u = t), o.push([s, u]);
174
+ for (let l = e; l < t; l += n) {
175
+ let u = l + n - r;
176
+ u > t && (u = t), o.push([l, u]);
174
177
  }
175
178
  return o;
176
179
  }
177
180
  function k(t) {
178
- return JSON.parse(JSON.stringify(t));
181
+ return isFinite(t) ? JSON.parse(JSON.stringify(t)) : t;
179
182
  }
180
- function A(t, n = !0) {
183
+ function z(t, n = !0) {
181
184
  const e = Number(t) * 60;
182
185
  return D(e, n);
183
186
  }
184
187
  function D(t, n = !0) {
185
188
  let e = Number(t);
186
189
  if ((!Number.isFinite(e) || e < 0) && (e = 0), e === 0) return "0 seconds";
187
- const r = 1, o = 60 * r, s = 60 * o, u = 24 * s, l = 7 * u, m = 4 * l, c = [
190
+ const r = 1, o = 60 * r, l = 60 * o, u = 24 * l, s = 7 * u, m = 4 * s, c = [
188
191
  ["year", 12 * m],
189
192
  ["month", m],
190
- ["week", l],
193
+ ["week", s],
191
194
  ["day", u],
192
- ["hour", s],
195
+ ["hour", l],
193
196
  ["minute", o],
194
197
  ["second", r]
195
198
  ];
@@ -202,15 +205,15 @@ function D(t, n = !0) {
202
205
  }
203
206
  }
204
207
  let h = e;
205
- const N = [];
208
+ const b = [];
206
209
  for (const [a, d] of c)
207
210
  if (h >= d) {
208
211
  const g = Math.floor(h / d);
209
- h -= g * d, N.push(`${g} ${a}${g === 1 ? "" : "s"}`);
212
+ h -= g * d, b.push(`${g} ${a}${g === 1 ? "" : "s"}`);
210
213
  }
211
- return N.join(", ");
214
+ return b.join(", ");
212
215
  }
213
- function C(t, n) {
216
+ function A(t, n) {
214
217
  const e = p;
215
218
  F(t);
216
219
  try {
@@ -219,7 +222,7 @@ function C(t, n) {
219
222
  F(e);
220
223
  }
221
224
  }
222
- function K(t, n) {
225
+ function C(t, n) {
223
226
  const e = $;
224
227
  M(t);
225
228
  try {
@@ -234,22 +237,22 @@ function F(t) {
234
237
  function M(t) {
235
238
  $ = t;
236
239
  }
237
- function L() {
240
+ function K() {
238
241
  return p;
239
242
  }
240
- function Y() {
243
+ function L() {
241
244
  return $;
242
245
  }
243
246
  export {
244
247
  x as abbreviate,
245
248
  G as clamp,
246
249
  T as currency,
247
- Y as defaultCurrency,
248
- L as defaultLocale,
250
+ L as defaultCurrency,
251
+ K as defaultLocale,
249
252
  R as fileSize,
250
253
  S as forHumans,
251
254
  f as format,
252
- A as minutesToHuman,
255
+ z as minutesToHuman,
253
256
  O as ordinal,
254
257
  H as pairs,
255
258
  y as parse,
@@ -257,10 +260,10 @@ export {
257
260
  E as parseInt,
258
261
  I as percentage,
259
262
  D as secondsToHuman,
260
- b as summarize,
263
+ N as summarize,
261
264
  k as trim,
262
265
  M as useCurrency,
263
266
  F as useLocale,
264
- K as withCurrency,
265
- C as withLocale
267
+ C as withCurrency,
268
+ A as withLocale
266
269
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/num",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "Utilities for working with numbers similar to Laravel's Num class facade.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",