@tolki/utils 1.6.4 → 1.7.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.
@@ -1 +1 @@
1
- {"version":3,"file":"cast.d.ts","sourceRoot":"","sources":["../src/cast.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAYrD;AAqFD;;;;;;;;;;;GAWG;AAEH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;IAAE,OAAO,IAAI,CAAC,EAAE,CAAA;CAAE,CAM1E;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,UAAU,CAAC,CAAC,EACxB,KAAK,EAAE,OAAO,GACf,KAAK,IAAI;IAAE,MAAM,IAAI,CAAC,CAAA;CAAE,GAAG;IAAE,MAAM,IAAI,CAAC,CAAA;CAAE,CAS5C;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,kBAAkB,CAAC,CAAC,EAChC,KAAK,EAAE,OAAO,GACf,KAAK,IAAI;IAAE,aAAa,IAAI,CAAC,CAAA;CAAE,CAMjC;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAG7D;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAC9B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,GACjC,CAAC,EAAE,GAAG,IAAI,CAKZ;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,CAG5E;AAwBD;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE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AO,GAAG,CAAC,EAAE,GAAG,IAAI,CAG7D;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAC9B,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,GACjC,CAAC,EAAE,GAAG,IAAI,CAKZ;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,EAAE,CAG5E;AAwBD;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,eAAe,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,EAAE,CAyBtD;AAED;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkCtE;AAED;;;;;;;GAOG;AAEH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAU1D;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAOrE;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAahD;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAiBpD"}
package/dist/guards.d.ts CHANGED
@@ -153,6 +153,19 @@ export declare function isNumber(value: unknown): value is number;
153
153
  * @returns True if the value is an integer
154
154
  */
155
155
  export declare function isInteger(value: unknown): value is number;
156
+ /**
157
+ * Check if a value is an integer a JavaScript number holds exactly: a whole number from -(2^53 - 1) to 2^53 - 1.
158
+ *
159
+ * @param value - The value to check
160
+ * @returns True if the value is a safe integer, false past `Number.MAX_SAFE_INTEGER`, where integers lose digits
161
+ *
162
+ * @example
163
+ *
164
+ * isSafeInteger(2 ** 53 - 1); -> true
165
+ * isSafeInteger(2 ** 53); -> false
166
+ * isSafeInteger(1.5); -> false
167
+ */
168
+ export declare function isSafeInteger(value: unknown): value is number;
156
169
  /**
157
170
  * Check if a value is a float.
158
171
  *
@@ -1 +1 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../src/guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;;;GAKG;AAEH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,GAAG,KAAK,IAAI,CAAC,EAAE,CAE5E;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,GAAG,WAAW,EAC3D,KAAK,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,GACjC,KAAK,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAEvB;AAED;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,aAAa,CACzB,KAAK,EAAE,OAAO,GACf,KAAK,IAAI,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAQvC;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,UAAU,CACtB,KAAK,EAAE,OAAO,GACf,KAAK,IAAI,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,CAQpD;AAED;;;;;;;;;;;GAWG;AAEH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE3D;AAED;;;;;;;;;;;;GAYG;AAEH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE9D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAA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AAI,MAAM,CAE9D;AAED;;;;;;;;;GASG;AAEH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE/D;AAkCD;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAe7D;AAED;;;;;;;GAOG;AAEH,wBAAgB,eAAe,CAC3B,MAAM,EAAE,SAAS,OAAO,EAAE,GAC3B,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAuB7B"}
package/dist/guards.js CHANGED
@@ -5,7 +5,7 @@ function e(e) {
5
5
  }
6
6
  /* @__NO_SIDE_EFFECTS__ */
7
7
  function t(t) {
8
- return !/* @__PURE__ */ b(t) && typeof t == "object" && !/* @__PURE__ */ e(t);
8
+ return !/* @__PURE__ */ x(t) && typeof t == "object" && !/* @__PURE__ */ e(t);
9
9
  }
10
10
  /* @__NO_SIDE_EFFECTS__ */
11
11
  function n(e) {
@@ -23,13 +23,13 @@ function i(e) {
23
23
  }
24
24
  /* @__NO_SIDE_EFFECTS__ */
25
25
  function a(e) {
26
- return !/* @__PURE__ */ b(e) && !/* @__PURE__ */ v(e) && /* @__PURE__ */ i(e);
26
+ return !/* @__PURE__ */ x(e) && !/* @__PURE__ */ y(e) && /* @__PURE__ */ i(e);
27
27
  }
28
28
  /* @__NO_SIDE_EFFECTS__ */
29
29
  function o(e) {
30
- if (!/* @__PURE__ */ a(e) && !/* @__PURE__ */ _(e)) return !1;
30
+ if (!/* @__PURE__ */ a(e) && !/* @__PURE__ */ v(e)) return !1;
31
31
  let t = Object.getOwnPropertyDescriptor(e, "constructor")?.value;
32
- return /* @__PURE__ */ _(t) && t.prototype === e;
32
+ return /* @__PURE__ */ v(t) && t.prototype === e;
33
33
  }
34
34
  /* @__NO_SIDE_EFFECTS__ */
35
35
  function s(e) {
@@ -41,7 +41,7 @@ function c(e) {
41
41
  }
42
42
  /* @__NO_SIDE_EFFECTS__ */
43
43
  function l(e) {
44
- return !!(/* @__PURE__ */ t(e) && /* @__PURE__ */ _(e.toString));
44
+ return !!(/* @__PURE__ */ t(e) && /* @__PURE__ */ v(e.toString));
45
45
  }
46
46
  /* @__NO_SIDE_EFFECTS__ */
47
47
  function u(e) {
@@ -53,122 +53,126 @@ function d(e) {
53
53
  }
54
54
  /* @__NO_SIDE_EFFECTS__ */
55
55
  function f(e) {
56
- return /* @__PURE__ */ u(e) && !Number.isInteger(e);
56
+ return Number.isSafeInteger(e);
57
57
  }
58
58
  /* @__NO_SIDE_EFFECTS__ */
59
59
  function p(e) {
60
- return /* @__PURE__ */ d(e) && e >= -(2 ** 63) && e < 2 ** 63 && !Object.is(e, -0);
60
+ return /* @__PURE__ */ u(e) && !Number.isInteger(e);
61
61
  }
62
62
  /* @__NO_SIDE_EFFECTS__ */
63
63
  function m(e) {
64
- return /* @__PURE__ */ u(e) && e >= 0;
64
+ return /* @__PURE__ */ d(e) && e >= -(2 ** 63) && e < 2 ** 63 && !Object.is(e, -0);
65
65
  }
66
66
  /* @__NO_SIDE_EFFECTS__ */
67
67
  function h(e) {
68
- return /* @__PURE__ */ u(e) && e < 0;
68
+ return /* @__PURE__ */ u(e) && e >= 0;
69
69
  }
70
70
  /* @__NO_SIDE_EFFECTS__ */
71
71
  function g(e) {
72
- return typeof e == "boolean";
72
+ return /* @__PURE__ */ u(e) && e < 0;
73
73
  }
74
74
  /* @__NO_SIDE_EFFECTS__ */
75
75
  function _(e) {
76
- return typeof e == "function";
76
+ return typeof e == "boolean";
77
77
  }
78
78
  /* @__NO_SIDE_EFFECTS__ */
79
79
  function v(e) {
80
- return e === void 0;
80
+ return typeof e == "function";
81
81
  }
82
82
  /* @__NO_SIDE_EFFECTS__ */
83
83
  function y(e) {
84
- return typeof e == "symbol";
84
+ return e === void 0;
85
85
  }
86
86
  /* @__NO_SIDE_EFFECTS__ */
87
87
  function b(e) {
88
- return e === null;
88
+ return typeof e == "symbol";
89
89
  }
90
90
  /* @__NO_SIDE_EFFECTS__ */
91
91
  function x(e) {
92
- return e instanceof Map;
92
+ return e === null;
93
93
  }
94
94
  /* @__NO_SIDE_EFFECTS__ */
95
95
  function S(e) {
96
- return e instanceof Set;
96
+ return e instanceof Map;
97
97
  }
98
98
  /* @__NO_SIDE_EFFECTS__ */
99
99
  function C(e) {
100
- return /* @__PURE__ */ b(e) || /* @__PURE__ */ v(e) || /* @__PURE__ */ s(e) ? !1 : /* @__PURE__ */ _(e[Symbol.iterator]);
100
+ return e instanceof Set;
101
101
  }
102
102
  /* @__NO_SIDE_EFFECTS__ */
103
103
  function w(e) {
104
- return e instanceof WeakMap;
104
+ return /* @__PURE__ */ x(e) || /* @__PURE__ */ y(e) || /* @__PURE__ */ s(e) ? !1 : /* @__PURE__ */ v(e[Symbol.iterator]);
105
105
  }
106
106
  /* @__NO_SIDE_EFFECTS__ */
107
107
  function T(e) {
108
- return e instanceof WeakSet;
108
+ return e instanceof WeakMap;
109
109
  }
110
110
  /* @__NO_SIDE_EFFECTS__ */
111
- function E(n) {
112
- return Number.isNaN(n) ? !0 : /* @__PURE__ */ u(n) ? n === 0 : /* @__PURE__ */ v(n) || /* @__PURE__ */ b(n) ? !0 : /* @__PURE__ */ g(n) ? n === !1 : /* @__PURE__ */ s(n) ? n.trim() === "" : /* @__PURE__ */ x(n) || /* @__PURE__ */ S(n) ? n.size === 0 : /* @__PURE__ */ e(n) ? n.length === 0 : /* @__PURE__ */ t(n) ? Object.keys(n).length === 0 : !1;
111
+ function E(e) {
112
+ return e instanceof WeakSet;
113
113
  }
114
114
  /* @__NO_SIDE_EFFECTS__ */
115
- function D(e) {
116
- return !/* @__PURE__ */ E(e);
115
+ function D(n) {
116
+ return Number.isNaN(n) ? !0 : /* @__PURE__ */ u(n) ? n === 0 : /* @__PURE__ */ y(n) || /* @__PURE__ */ x(n) ? !0 : /* @__PURE__ */ _(n) ? n === !1 : /* @__PURE__ */ s(n) ? n.trim() === "" : /* @__PURE__ */ S(n) || /* @__PURE__ */ C(n) ? n.size === 0 : /* @__PURE__ */ e(n) ? n.length === 0 : /* @__PURE__ */ t(n) ? Object.keys(n).length === 0 : !1;
117
117
  }
118
118
  /* @__NO_SIDE_EFFECTS__ */
119
- function O(t) {
120
- return t === !1 || t === null || /* @__PURE__ */ v(t) || t === 0 || t === 0n || t === "" || t === "0" ? !0 : /* @__PURE__ */ e(t) ? t.length === 0 : /* @__PURE__ */ x(t) || /* @__PURE__ */ S(t) ? t.size === 0 : /* @__PURE__ */ n(t) ? Object.keys(t).length === 0 : !1;
119
+ function O(e) {
120
+ return !/* @__PURE__ */ D(e);
121
121
  }
122
- var k = /^[ \t\n\r\v\f]*[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[ \t\n\r\v\f]*$/;
123
122
  /* @__NO_SIDE_EFFECTS__ */
124
- function A(e) {
125
- return typeof e == "number" ? !0 : /* @__PURE__ */ s(e) ? k.test(e) : !1;
123
+ function k(t) {
124
+ return t === !1 || t === null || /* @__PURE__ */ y(t) || t === 0 || t === 0n || t === "" || t === "0" ? !0 : /* @__PURE__ */ e(t) ? t.length === 0 : /* @__PURE__ */ S(t) || /* @__PURE__ */ C(t) ? t.size === 0 : /* @__PURE__ */ n(t) ? Object.keys(t).length === 0 : !1;
126
125
  }
126
+ var A = /^[ \t\n\r\v\f]*[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[ \t\n\r\v\f]*$/;
127
127
  /* @__NO_SIDE_EFFECTS__ */
128
128
  function j(e) {
129
- return /* @__PURE__ */ b(e) || /* @__PURE__ */ g(e) || /* @__PURE__ */ u(e) || /* @__PURE__ */ s(e) || /* @__PURE__ */ y(e) || /* @__PURE__ */ v(e);
129
+ return typeof e == "number" ? !0 : /* @__PURE__ */ s(e) ? A.test(e) : !1;
130
130
  }
131
131
  /* @__NO_SIDE_EFFECTS__ */
132
132
  function M(e) {
133
- return !/* @__PURE__ */ j(e);
133
+ return /* @__PURE__ */ x(e) || /* @__PURE__ */ _(e) || /* @__PURE__ */ u(e) || /* @__PURE__ */ s(e) || /* @__PURE__ */ b(e) || /* @__PURE__ */ y(e);
134
134
  }
135
135
  /* @__NO_SIDE_EFFECTS__ */
136
136
  function N(e) {
137
- return /* @__PURE__ */ u(e) && Number.isFinite(e);
137
+ return !/* @__PURE__ */ M(e);
138
138
  }
139
139
  /* @__NO_SIDE_EFFECTS__ */
140
140
  function P(e) {
141
+ return /* @__PURE__ */ u(e) && Number.isFinite(e);
142
+ }
143
+ /* @__NO_SIDE_EFFECTS__ */
144
+ function F(e) {
141
145
  return Array.isArray(e);
142
146
  }
143
147
  /* @__NO_SIDE_EFFECTS__ */
144
- function F(t) {
145
- return /* @__PURE__ */ e(t) || /* @__PURE__ */ n(t) || /* @__PURE__ */ x(t);
148
+ function I(t) {
149
+ return /* @__PURE__ */ e(t) || /* @__PURE__ */ n(t) || /* @__PURE__ */ S(t);
146
150
  }
147
- function I(e) {
151
+ function L(e) {
148
152
  if (/* @__PURE__ */ s(e)) return e;
149
- if (/* @__PURE__ */ g(e)) return e ? "1" : "";
150
- if (/* @__PURE__ */ b(e)) return "";
151
- if (/* @__PURE__ */ N(e)) {
153
+ if (/* @__PURE__ */ _(e)) return e ? "1" : "";
154
+ if (/* @__PURE__ */ x(e)) return "";
155
+ if (/* @__PURE__ */ P(e)) {
152
156
  let t = String(e);
153
157
  return t.includes("e") ? null : t;
154
158
  }
155
159
  return null;
156
160
  }
157
161
  /* @__NO_SIDE_EFFECTS__ */
158
- function L(e, t) {
159
- let n = I(e), r = I(t);
162
+ function R(e, t) {
163
+ let n = L(e), r = L(t);
160
164
  return n !== null && r !== null ? n === r : e === t || typeof e == "number" && typeof t == "number" && Number.isNaN(e) && Number.isNaN(t);
161
165
  }
162
166
  /* @__NO_SIDE_EFFECTS__ */
163
- function R(e) {
167
+ function z(e) {
164
168
  let t = /* @__PURE__ */ new Set(), n = [];
165
169
  for (let r of e) {
166
- let e = I(r);
167
- /* @__PURE__ */ b(e) ? n.push(r) : t.add(e);
170
+ let e = L(r);
171
+ /* @__PURE__ */ x(e) ? n.push(r) : t.add(e);
168
172
  }
169
173
  return (e) => {
170
- let r = I(e);
171
- return /* @__PURE__ */ b(r) ? n.some((t) => /* @__PURE__ */ L(e, t)) : t.has(r);
174
+ let r = L(e);
175
+ return /* @__PURE__ */ x(r) ? n.some((t) => /* @__PURE__ */ R(e, t)) : t.has(r);
172
176
  };
173
177
  }
174
- export { P as isAccessibleData, e as isArray, g as isBoolean, r as isEnumCase, E as isFalsy, N as isFiniteNumber, f as isFloat, _ as isFunction, d as isInteger, C as isIterable, x as isMap, h as isNegativeNumber, M as isNonPrimitive, b as isNull, u as isNumber, t as isObject, i as isObjectAny, F as isPhpAccessible, O as isPhpFalsy, p as isPhpInt, A as isPhpNumeric, n as isPlainObject, m as isPositiveNumber, j as isPrimitive, o as isPrototypeObject, S as isSet, s as isString, c as isStringable, y as isSymbol, D as isTruthy, a as isTruthyObject, v as isUndefined, w as isWeakMap, T as isWeakSet, l as objectToString, L as phpValueMatch, R as phpValueMatcher };
178
+ export { F as isAccessibleData, e as isArray, _ as isBoolean, r as isEnumCase, D as isFalsy, P as isFiniteNumber, p as isFloat, v as isFunction, d as isInteger, w as isIterable, S as isMap, g as isNegativeNumber, N as isNonPrimitive, x as isNull, u as isNumber, t as isObject, i as isObjectAny, I as isPhpAccessible, k as isPhpFalsy, m as isPhpInt, j as isPhpNumeric, n as isPlainObject, h as isPositiveNumber, M as isPrimitive, o as isPrototypeObject, f as isSafeInteger, C as isSet, s as isString, c as isStringable, b as isSymbol, O as isTruthy, a as isTruthyObject, y as isUndefined, T as isWeakMap, E as isWeakSet, l as objectToString, R as phpValueMatch, z as phpValueMatcher };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './utils';
1
+ export * from './utils.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
- import { isAccessibleData as e, isArray as t, isBoolean as n, isEnumCase as r, isFalsy as i, isFiniteNumber as a, isFloat as o, isFunction as s, isInteger as c, isIterable as l, isMap as u, isNegativeNumber as d, isNonPrimitive as f, isNull as p, isNumber as m, isObject as h, isObjectAny as g, isPhpAccessible as _, isPhpFalsy as v, isPhpInt as y, isPhpNumeric as b, isPlainObject as x, isPositiveNumber as S, isPrimitive as C, isPrototypeObject as w, isSet as T, isString as E, isStringable as D, isSymbol as O, isTruthy as k, isTruthyObject as A, isUndefined as j, isWeakMap as M, isWeakSet as N, objectToString as P, phpValueMatch as F, phpValueMatcher as I } from "./guards.js";
2
- import { phpDebugType as L, phpTypeName as R, resolveDefault as z, typeOf as B } from "./reflect.js";
3
- import { arrayKeyExistsError as V, defineKey as H, deleteMapKey as U, entriesKeyValue as W, hasOwnToString as G, isIllegalOffset as K, isIntegerLikeKey as q, isPhpArrayKey as J, isUnsafeKey as Y, keyedEntries as X, nextIntegerKey as Z, phpArrayKey as Q, phpComputedKey as $, readMapKey as ee, reindexIntegerKeys as te, renumberPhpIntegerKeys as ne, writeMapKey as re } from "./keys.js";
4
- import { arrayableItems as ie, arrayableValues as ae, castableToArray as oe, cssListItemToString as se, getAccessibleValues as ce, normalizeToArray as le, phpIntArgument as ue, phpIntCast as de, phpStringCast as fe, toArrayable as pe, toJsonSerializable as me, toJsonable as he, toPhpKeyString as ge } from "./cast.js";
5
- import { compareValues as _e, looseEqual as ve, operatorMatch as ye, strictEqual as be } from "./equality.js";
6
- import { InvalidArgumentException as xe, ItemNotFoundException as Se, MultipleItemsFoundException as Ce, UnexpectedValueException as we } from "./exceptions.js";
7
- import { resolvePadLength as Te, resolveRangeSize as Ee, resolveSliceRange as De, resolveSpliceRange as Oe, resolveTakeCount as ke } from "./range.js";
8
- import { createSortSpecComparator as Ae, phpSortComparator as je } from "./sorting.js";
9
- import { arrayValueMessage as Me, escapeShellArg as Ne, escapeWindowsShellArg as Pe, lowerFirst as Fe, toLower as Ie, toUpper as Le, upperFirst as Re } from "./string.js";
1
+ import { isAccessibleData as e, isArray as t, isBoolean as n, isEnumCase as r, isFalsy as i, isFiniteNumber as a, isFloat as o, isFunction as s, isInteger as c, isIterable as l, isMap as u, isNegativeNumber as d, isNonPrimitive as f, isNull as p, isNumber as m, isObject as h, isObjectAny as g, isPhpAccessible as _, isPhpFalsy as v, isPhpInt as y, isPhpNumeric as b, isPlainObject as x, isPositiveNumber as S, isPrimitive as C, isPrototypeObject as w, isSafeInteger as T, isSet as E, isString as D, isStringable as O, isSymbol as k, isTruthy as A, isTruthyObject as j, isUndefined as M, isWeakMap as N, isWeakSet as P, objectToString as F, phpValueMatch as I, phpValueMatcher as L } from "./guards.js";
2
+ import { phpDebugType as R, phpTypeName as z, resolveDefault as B, typeOf as V } from "./reflect.js";
3
+ import { arrayKeyExistsError as H, defineKey as U, deleteMapKey as W, entriesKeyValue as G, hasOwnToString as K, isIllegalOffset as q, isIntegerLikeKey as J, isPhpArrayKey as Y, isUnsafeKey as X, keyedEntries as Z, nextIntegerKey as Q, phpArrayKey as $, phpComputedKey as ee, readMapKey as te, reindexIntegerKeys as ne, renumberPhpIntegerKeys as re, writeMapKey as ie } from "./keys.js";
4
+ import { arrayableItems as ae, arrayableValues as oe, castableToArray as se, cssListItemToString as ce, getAccessibleValues as le, normalizeToArray as ue, phpIntArgument as de, phpIntCast as fe, phpStringCast as pe, toArrayable as me, toJsonSerializable as he, toJsonable as ge, toPhpKeyString as _e } from "./cast.js";
5
+ import { compareValues as ve, looseEqual as ye, operatorMatch as be, strictEqual as xe } from "./equality.js";
6
+ import { InvalidArgumentException as Se, ItemNotFoundException as Ce, MultipleItemsFoundException as we, UnexpectedValueException as Te } from "./exceptions.js";
7
+ import { localeTag as Ee, normalizeLocale as De } from "./locale.js";
8
+ import { resolvePadLength as Oe, resolveRangeSize as ke, resolveSliceRange as Ae, resolveSpliceRange as je, resolveTakeCount as Me } from "./range.js";
9
+ import { createSortSpecComparator as Ne, phpSortComparator as Pe } from "./sorting.js";
10
+ import { arrayValueMessage as Fe, escapeShellArg as Ie, escapeWindowsShellArg as Le, lowerFirst as Re, toLower as ze, toUpper as Be, upperFirst as Ve } from "./string.js";
10
11
  import "./utils.js";
11
- export { xe as InvalidArgumentException, Se as ItemNotFoundException, Ce as MultipleItemsFoundException, we as UnexpectedValueException, V as arrayKeyExistsError, Me as arrayValueMessage, ie as arrayableItems, ae as arrayableValues, oe as castableToArray, _e as compareValues, Ae as createSortSpecComparator, se as cssListItemToString, H as defineKey, U as deleteMapKey, W as entriesKeyValue, Ne as escapeShellArg, Pe as escapeWindowsShellArg, ce as getAccessibleValues, G as hasOwnToString, e as isAccessibleData, t as isArray, n as isBoolean, r as isEnumCase, i as isFalsy, a as isFiniteNumber, o as isFloat, s as isFunction, K as isIllegalOffset, c as isInteger, q as isIntegerLikeKey, l as isIterable, u as isMap, d as isNegativeNumber, f as isNonPrimitive, p as isNull, m as isNumber, h as isObject, g as isObjectAny, _ as isPhpAccessible, J as isPhpArrayKey, v as isPhpFalsy, y as isPhpInt, b as isPhpNumeric, x as isPlainObject, S as isPositiveNumber, C as isPrimitive, w as isPrototypeObject, T as isSet, E as isString, D as isStringable, O as isSymbol, k as isTruthy, A as isTruthyObject, j as isUndefined, Y as isUnsafeKey, M as isWeakMap, N as isWeakSet, X as keyedEntries, ve as looseEqual, Fe as lowerFirst, Z as nextIntegerKey, le as normalizeToArray, P as objectToString, ye as operatorMatch, Q as phpArrayKey, $ as phpComputedKey, L as phpDebugType, ue as phpIntArgument, de as phpIntCast, je as phpSortComparator, fe as phpStringCast, R as phpTypeName, F as phpValueMatch, I as phpValueMatcher, ee as readMapKey, te as reindexIntegerKeys, ne as renumberPhpIntegerKeys, z as resolveDefault, Te as resolvePadLength, Ee as resolveRangeSize, De as resolveSliceRange, Oe as resolveSpliceRange, ke as resolveTakeCount, be as strictEqual, pe as toArrayable, me as toJsonSerializable, he as toJsonable, Ie as toLower, ge as toPhpKeyString, Le as toUpper, B as typeOf, Re as upperFirst, re as writeMapKey };
12
+ export { Se as InvalidArgumentException, Ce as ItemNotFoundException, we as MultipleItemsFoundException, Te as UnexpectedValueException, H as arrayKeyExistsError, Fe as arrayValueMessage, ae as arrayableItems, oe as arrayableValues, se as castableToArray, ve as compareValues, Ne as createSortSpecComparator, ce as cssListItemToString, U as defineKey, W as deleteMapKey, G as entriesKeyValue, Ie as escapeShellArg, Le as escapeWindowsShellArg, le as getAccessibleValues, K as hasOwnToString, e as isAccessibleData, t as isArray, n as isBoolean, r as isEnumCase, i as isFalsy, a as isFiniteNumber, o as isFloat, s as isFunction, q as isIllegalOffset, c as isInteger, J as isIntegerLikeKey, l as isIterable, u as isMap, d as isNegativeNumber, f as isNonPrimitive, p as isNull, m as isNumber, h as isObject, g as isObjectAny, _ as isPhpAccessible, Y as isPhpArrayKey, v as isPhpFalsy, y as isPhpInt, b as isPhpNumeric, x as isPlainObject, S as isPositiveNumber, C as isPrimitive, w as isPrototypeObject, T as isSafeInteger, E as isSet, D as isString, O as isStringable, k as isSymbol, A as isTruthy, j as isTruthyObject, M as isUndefined, X as isUnsafeKey, N as isWeakMap, P as isWeakSet, Z as keyedEntries, Ee as localeTag, ye as looseEqual, Re as lowerFirst, Q as nextIntegerKey, De as normalizeLocale, ue as normalizeToArray, F as objectToString, be as operatorMatch, $ as phpArrayKey, ee as phpComputedKey, R as phpDebugType, de as phpIntArgument, fe as phpIntCast, Pe as phpSortComparator, pe as phpStringCast, z as phpTypeName, I as phpValueMatch, L as phpValueMatcher, te as readMapKey, ne as reindexIntegerKeys, re as renumberPhpIntegerKeys, B as resolveDefault, Oe as resolvePadLength, ke as resolveRangeSize, Ae as resolveSliceRange, je as resolveSpliceRange, Me as resolveTakeCount, xe as strictEqual, me as toArrayable, he as toJsonSerializable, ge as toJsonable, ze as toLower, _e as toPhpKeyString, Be as toUpper, V as typeOf, Ve as upperFirst, ie as writeMapKey };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Turn a BCP 47 tag into the spelling Laravel's plural table uses.
3
+ *
4
+ * @param locale - The locale tag, such as `en-US` or `pt-br`.
5
+ * @returns The locale spelled `en_US`: two-letter subtags after the first upper-cased, four-letter ones title-cased.
6
+ *
7
+ * @example
8
+ *
9
+ * normalizeLocale("pt-br"); // "pt_BR"
10
+ * normalizeLocale("zh-hant-tw"); // "zh_Hant_TW"
11
+ */
12
+ export declare function normalizeLocale(locale: string): string;
13
+ /**
14
+ * Turn a locale spelled as Laravel does into the BCP 47 tag `Intl` reads.
15
+ *
16
+ * @param locale - The locale, such as `pt_BR` or `zh_hant_tw`.
17
+ * @returns The canonical tag, or the input with its underscores replaced when `Intl` cannot read it.
18
+ *
19
+ * @example
20
+ *
21
+ * localeTag("pt_BR"); // "pt-BR"
22
+ * localeTag("zh_hant_tw"); // "zh-Hant-TW"
23
+ */
24
+ export declare function localeTag(locale: string): string;
25
+ //# sourceMappingURL=locale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.d.ts","sourceRoot":"","sources":["../src/locale.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAqBtD;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQhD"}
package/dist/locale.js ADDED
@@ -0,0 +1,15 @@
1
+ // src/locale.ts
2
+ /* @__NO_SIDE_EFFECTS__ */
3
+ function e(e) {
4
+ return e.trim().toLowerCase().split(/[-_\s]+/).map((e, t) => t === 0 ? e : /^[a-z]{2}$/.test(e) ? e.toUpperCase() : /^[a-z]{4}$/.test(e) ? e.charAt(0).toUpperCase() + e.slice(1) : e).join("_");
5
+ }
6
+ /* @__NO_SIDE_EFFECTS__ */
7
+ function t(e) {
8
+ let t = e.replaceAll("_", "-");
9
+ try {
10
+ return Intl.getCanonicalLocales(t)[0];
11
+ } catch {
12
+ return t;
13
+ }
14
+ }
15
+ export { t as localeTag, e as normalizeLocale };
package/dist/utils.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- export * from './cast';
2
- export * from './equality';
3
- export * from './exceptions';
4
- export * from './guards';
5
- export * from './keys';
6
- export * from './range';
7
- export * from './reflect';
8
- export * from './sorting';
9
- export * from './string';
1
+ export * from './cast.js';
2
+ export * from './equality.js';
3
+ export * from './exceptions.js';
4
+ export * from './guards.js';
5
+ export * from './keys.js';
6
+ export * from './locale.js';
7
+ export * from './range.js';
8
+ export * from './reflect.js';
9
+ export * from './sorting.js';
10
+ export * from './string.js';
10
11
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
package/dist/utils.js CHANGED
@@ -1,10 +1,11 @@
1
- import { isAccessibleData as e, isArray as t, isBoolean as n, isEnumCase as r, isFalsy as i, isFiniteNumber as a, isFloat as o, isFunction as s, isInteger as c, isIterable as l, isMap as u, isNegativeNumber as d, isNonPrimitive as f, isNull as p, isNumber as m, isObject as h, isObjectAny as g, isPhpAccessible as _, isPhpFalsy as v, isPhpInt as y, isPhpNumeric as b, isPlainObject as x, isPositiveNumber as S, isPrimitive as C, isPrototypeObject as w, isSet as T, isString as E, isStringable as D, isSymbol as O, isTruthy as k, isTruthyObject as A, isUndefined as j, isWeakMap as M, isWeakSet as N, objectToString as P, phpValueMatch as F, phpValueMatcher as I } from "./guards.js";
2
- import { phpDebugType as L, phpTypeName as R, resolveDefault as z, typeOf as B } from "./reflect.js";
3
- import { arrayKeyExistsError as V, defineKey as H, deleteMapKey as U, entriesKeyValue as W, hasOwnToString as G, isIllegalOffset as K, isIntegerLikeKey as q, isPhpArrayKey as J, isUnsafeKey as Y, keyedEntries as X, nextIntegerKey as Z, phpArrayKey as Q, phpComputedKey as $, readMapKey as ee, reindexIntegerKeys as te, renumberPhpIntegerKeys as ne, writeMapKey as re } from "./keys.js";
4
- import { arrayableItems as ie, arrayableValues as ae, castableToArray as oe, cssListItemToString as se, getAccessibleValues as ce, normalizeToArray as le, phpIntArgument as ue, phpIntCast as de, phpStringCast as fe, toArrayable as pe, toJsonSerializable as me, toJsonable as he, toPhpKeyString as ge } from "./cast.js";
5
- import { compareValues as _e, looseEqual as ve, operatorMatch as ye, strictEqual as be } from "./equality.js";
6
- import { InvalidArgumentException as xe, ItemNotFoundException as Se, MultipleItemsFoundException as Ce, UnexpectedValueException as we } from "./exceptions.js";
7
- import { resolvePadLength as Te, resolveRangeSize as Ee, resolveSliceRange as De, resolveSpliceRange as Oe, resolveTakeCount as ke } from "./range.js";
8
- import { createSortSpecComparator as Ae, phpSortComparator as je } from "./sorting.js";
9
- import { arrayValueMessage as Me, escapeShellArg as Ne, escapeWindowsShellArg as Pe, lowerFirst as Fe, toLower as Ie, toUpper as Le, upperFirst as Re } from "./string.js";
10
- export { xe as InvalidArgumentException, Se as ItemNotFoundException, Ce as MultipleItemsFoundException, we as UnexpectedValueException, V as arrayKeyExistsError, Me as arrayValueMessage, ie as arrayableItems, ae as arrayableValues, oe as castableToArray, _e as compareValues, Ae as createSortSpecComparator, se as cssListItemToString, H as defineKey, U as deleteMapKey, W as entriesKeyValue, Ne as escapeShellArg, Pe as escapeWindowsShellArg, ce as getAccessibleValues, G as hasOwnToString, e as isAccessibleData, t as isArray, n as isBoolean, r as isEnumCase, i as isFalsy, a as isFiniteNumber, o as isFloat, s as isFunction, K as isIllegalOffset, c as isInteger, q as isIntegerLikeKey, l as isIterable, u as isMap, d as isNegativeNumber, f as isNonPrimitive, p as isNull, m as isNumber, h as isObject, g as isObjectAny, _ as isPhpAccessible, J as isPhpArrayKey, v as isPhpFalsy, y as isPhpInt, b as isPhpNumeric, x as isPlainObject, S as isPositiveNumber, C as isPrimitive, w as isPrototypeObject, T as isSet, E as isString, D as isStringable, O as isSymbol, k as isTruthy, A as isTruthyObject, j as isUndefined, Y as isUnsafeKey, M as isWeakMap, N as isWeakSet, X as keyedEntries, ve as looseEqual, Fe as lowerFirst, Z as nextIntegerKey, le as normalizeToArray, P as objectToString, ye as operatorMatch, Q as phpArrayKey, $ as phpComputedKey, L as phpDebugType, ue as phpIntArgument, de as phpIntCast, je as phpSortComparator, fe as phpStringCast, R as phpTypeName, F as phpValueMatch, I as phpValueMatcher, ee as readMapKey, te as reindexIntegerKeys, ne as renumberPhpIntegerKeys, z as resolveDefault, Te as resolvePadLength, Ee as resolveRangeSize, De as resolveSliceRange, Oe as resolveSpliceRange, ke as resolveTakeCount, be as strictEqual, pe as toArrayable, me as toJsonSerializable, he as toJsonable, Ie as toLower, ge as toPhpKeyString, Le as toUpper, B as typeOf, Re as upperFirst, re as writeMapKey };
1
+ import { isAccessibleData as e, isArray as t, isBoolean as n, isEnumCase as r, isFalsy as i, isFiniteNumber as a, isFloat as o, isFunction as s, isInteger as c, isIterable as l, isMap as u, isNegativeNumber as d, isNonPrimitive as f, isNull as p, isNumber as m, isObject as h, isObjectAny as g, isPhpAccessible as _, isPhpFalsy as v, isPhpInt as y, isPhpNumeric as b, isPlainObject as x, isPositiveNumber as S, isPrimitive as C, isPrototypeObject as w, isSafeInteger as T, isSet as E, isString as D, isStringable as O, isSymbol as k, isTruthy as A, isTruthyObject as j, isUndefined as M, isWeakMap as N, isWeakSet as P, objectToString as F, phpValueMatch as I, phpValueMatcher as L } from "./guards.js";
2
+ import { phpDebugType as R, phpTypeName as z, resolveDefault as B, typeOf as V } from "./reflect.js";
3
+ import { arrayKeyExistsError as H, defineKey as U, deleteMapKey as W, entriesKeyValue as G, hasOwnToString as K, isIllegalOffset as q, isIntegerLikeKey as J, isPhpArrayKey as Y, isUnsafeKey as X, keyedEntries as Z, nextIntegerKey as Q, phpArrayKey as $, phpComputedKey as ee, readMapKey as te, reindexIntegerKeys as ne, renumberPhpIntegerKeys as re, writeMapKey as ie } from "./keys.js";
4
+ import { arrayableItems as ae, arrayableValues as oe, castableToArray as se, cssListItemToString as ce, getAccessibleValues as le, normalizeToArray as ue, phpIntArgument as de, phpIntCast as fe, phpStringCast as pe, toArrayable as me, toJsonSerializable as he, toJsonable as ge, toPhpKeyString as _e } from "./cast.js";
5
+ import { compareValues as ve, looseEqual as ye, operatorMatch as be, strictEqual as xe } from "./equality.js";
6
+ import { InvalidArgumentException as Se, ItemNotFoundException as Ce, MultipleItemsFoundException as we, UnexpectedValueException as Te } from "./exceptions.js";
7
+ import { localeTag as Ee, normalizeLocale as De } from "./locale.js";
8
+ import { resolvePadLength as Oe, resolveRangeSize as ke, resolveSliceRange as Ae, resolveSpliceRange as je, resolveTakeCount as Me } from "./range.js";
9
+ import { createSortSpecComparator as Ne, phpSortComparator as Pe } from "./sorting.js";
10
+ import { arrayValueMessage as Fe, escapeShellArg as Ie, escapeWindowsShellArg as Le, lowerFirst as Re, toLower as ze, toUpper as Be, upperFirst as Ve } from "./string.js";
11
+ export { Se as InvalidArgumentException, Ce as ItemNotFoundException, we as MultipleItemsFoundException, Te as UnexpectedValueException, H as arrayKeyExistsError, Fe as arrayValueMessage, ae as arrayableItems, oe as arrayableValues, se as castableToArray, ve as compareValues, Ne as createSortSpecComparator, ce as cssListItemToString, U as defineKey, W as deleteMapKey, G as entriesKeyValue, Ie as escapeShellArg, Le as escapeWindowsShellArg, le as getAccessibleValues, K as hasOwnToString, e as isAccessibleData, t as isArray, n as isBoolean, r as isEnumCase, i as isFalsy, a as isFiniteNumber, o as isFloat, s as isFunction, q as isIllegalOffset, c as isInteger, J as isIntegerLikeKey, l as isIterable, u as isMap, d as isNegativeNumber, f as isNonPrimitive, p as isNull, m as isNumber, h as isObject, g as isObjectAny, _ as isPhpAccessible, Y as isPhpArrayKey, v as isPhpFalsy, y as isPhpInt, b as isPhpNumeric, x as isPlainObject, S as isPositiveNumber, C as isPrimitive, w as isPrototypeObject, T as isSafeInteger, E as isSet, D as isString, O as isStringable, k as isSymbol, A as isTruthy, j as isTruthyObject, M as isUndefined, X as isUnsafeKey, N as isWeakMap, P as isWeakSet, Z as keyedEntries, Ee as localeTag, ye as looseEqual, Re as lowerFirst, Q as nextIntegerKey, De as normalizeLocale, ue as normalizeToArray, F as objectToString, be as operatorMatch, $ as phpArrayKey, ee as phpComputedKey, R as phpDebugType, de as phpIntArgument, fe as phpIntCast, Pe as phpSortComparator, pe as phpStringCast, z as phpTypeName, I as phpValueMatch, L as phpValueMatcher, te as readMapKey, ne as reindexIntegerKeys, re as renumberPhpIntegerKeys, B as resolveDefault, Oe as resolvePadLength, ke as resolveRangeSize, Ae as resolveSliceRange, je as resolveSpliceRange, Me as resolveTakeCount, xe as strictEqual, me as toArrayable, he as toJsonSerializable, ge as toJsonable, ze as toLower, _e as toPhpKeyString, Be as toUpper, V as typeOf, Ve as upperFirst, ie as writeMapKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/utils",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
4
4
  "description": "A set of utility functions for the @tolki packages.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",
@@ -15,7 +15,7 @@
15
15
  "type": "module",
16
16
  "main": "dist/index.js",
17
17
  "dependencies": {
18
- "@tolki/types": "^1.12.0"
18
+ "@tolki/types": "^1.13.0"
19
19
  },
20
20
  "sideEffects": false,
21
21
  "files": [
@@ -27,13 +27,11 @@
27
27
  "types": "dist/index.d.ts",
28
28
  "exports": {
29
29
  ".": {
30
- "import": "./dist/index.js",
31
- "require": "./dist/index.js",
32
- "types": "./dist/index.d.ts"
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
33
32
  },
34
33
  "./utils": {
35
34
  "types": "./dist/utils.d.ts",
36
- "import": "./dist/utils.js",
37
35
  "default": "./dist/utils.js"
38
36
  }
39
37
  }