@tolki/utils 1.3.0 → 1.4.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/dist/cast.d.ts +30 -0
- package/dist/cast.d.ts.map +1 -1
- package/dist/cast.js +91 -33
- package/dist/equality.d.ts +52 -2
- package/dist/equality.d.ts.map +1 -1
- package/dist/equality.js +146 -85
- package/dist/exceptions.d.ts +32 -0
- package/dist/exceptions.d.ts.map +1 -0
- package/dist/exceptions.js +24 -0
- package/dist/guards.d.ts +37 -0
- package/dist/guards.d.ts.map +1 -1
- package/dist/guards.js +80 -69
- package/dist/index.js +76 -65
- package/dist/keys.d.ts +43 -0
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +62 -21
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +76 -65
- package/package.json +2 -2
package/dist/guards.d.ts
CHANGED
|
@@ -19,6 +19,21 @@ export declare function isArray<T>(value: DataItems<T> | T[] | unknown): value i
|
|
|
19
19
|
* isObject(null); -> false
|
|
20
20
|
*/
|
|
21
21
|
export declare function isObject<T, K extends PropertyKey = PropertyKey>(value: DataItems<T, K> | unknown): value is Record<K, T>;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a value is a plain object: one whose prototype is `Object.prototype`
|
|
24
|
+
* or `null`, the shape this port models a PHP array with.
|
|
25
|
+
*
|
|
26
|
+
* @param value - The value to check
|
|
27
|
+
* @returns True if the value is a plain object
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
*
|
|
31
|
+
* isPlainObject({ a: 1 }); -> true
|
|
32
|
+
* isPlainObject(Object.create(null)); -> true
|
|
33
|
+
* isPlainObject(new Date()); -> false
|
|
34
|
+
* isPlainObject([1, 2]); -> false
|
|
35
|
+
*/
|
|
36
|
+
export declare function isPlainObject(value: unknown): value is Record<PropertyKey, unknown>;
|
|
22
37
|
/**
|
|
23
38
|
* Check if a value is any object (including arrays, null).
|
|
24
39
|
*
|
|
@@ -401,6 +416,28 @@ export declare function isFiniteNumber(value: unknown): value is number;
|
|
|
401
416
|
* isAccessibleData('hello'); -> false
|
|
402
417
|
*/
|
|
403
418
|
export declare function isAccessibleData(data: unknown): boolean;
|
|
419
|
+
/**
|
|
420
|
+
* Check whether a value is one PHP's `Arr::accessible` would walk: a value that
|
|
421
|
+
* carries array entries rather than object state.
|
|
422
|
+
*
|
|
423
|
+
* An array and a plain object both model a PHP array; a `Map` is the JavaScript
|
|
424
|
+
* shape for a PHP array with non-string keys. A `Date`, a `Set`, a class instance
|
|
425
|
+
* or any other exotic object keeps its state somewhere other than its own
|
|
426
|
+
* enumerable keys, so walking it reads nothing — PHP rejects a `DateTime` the
|
|
427
|
+
* same way, because it does not implement `ArrayAccess`.
|
|
428
|
+
*
|
|
429
|
+
* @param value - The value to check
|
|
430
|
+
* @returns True if the value's own entries are its data
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
*
|
|
434
|
+
* isPhpAccessible({ a: 1 }); -> true
|
|
435
|
+
* isPhpAccessible([1, 2]); -> true
|
|
436
|
+
* isPhpAccessible(new Map()); -> true
|
|
437
|
+
* isPhpAccessible(new Date()); -> false
|
|
438
|
+
* isPhpAccessible(new Set()); -> false
|
|
439
|
+
*/
|
|
440
|
+
export declare function isPhpAccessible(value: unknown): value is object;
|
|
404
441
|
/**
|
|
405
442
|
* Determine whether two values match the way PHP's `array_diff`/`array_intersect`
|
|
406
443
|
* do: `(string) $a === (string) $b`. Only `string`, `boolean`, `null`, and plain
|
package/dist/guards.d.ts.map
CHANGED
|
@@ -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;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,CAA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G,OAAO,CAEvD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAE/D;AAkCD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAe7D;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,MAAM,EAAE,SAAS,OAAO,EAAE,GAC3B,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAuB7B"}
|
package/dist/guards.js
CHANGED
|
@@ -1,55 +1,61 @@
|
|
|
1
|
-
function
|
|
1
|
+
function y(t) {
|
|
2
2
|
return Array.isArray(t);
|
|
3
3
|
}
|
|
4
4
|
function b(t) {
|
|
5
|
-
return !i(t) && typeof t == "object" && !
|
|
5
|
+
return !i(t) && typeof t == "object" && !y(t);
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function h(t) {
|
|
8
|
+
if (!b(t))
|
|
9
|
+
return !1;
|
|
10
|
+
const n = Object.getPrototypeOf(t);
|
|
11
|
+
return n === Object.prototype || n === null;
|
|
12
|
+
}
|
|
13
|
+
function S(t) {
|
|
8
14
|
return typeof t == "object";
|
|
9
15
|
}
|
|
10
|
-
function
|
|
11
|
-
return !i(t) && !
|
|
16
|
+
function P(t) {
|
|
17
|
+
return !i(t) && !c(t) && S(t);
|
|
12
18
|
}
|
|
13
|
-
function
|
|
14
|
-
if (!
|
|
19
|
+
function T(t) {
|
|
20
|
+
if (!P(t) && !u(t))
|
|
15
21
|
return !1;
|
|
16
22
|
const n = Object.getOwnPropertyDescriptor(
|
|
17
23
|
t,
|
|
18
24
|
"constructor"
|
|
19
25
|
)?.value;
|
|
20
|
-
return
|
|
26
|
+
return u(n) && n.prototype === t;
|
|
21
27
|
}
|
|
22
28
|
function o(t) {
|
|
23
29
|
return typeof t == "string";
|
|
24
30
|
}
|
|
25
|
-
function
|
|
26
|
-
return !!(o(t) || e(t) ||
|
|
31
|
+
function W(t) {
|
|
32
|
+
return !!(o(t) || e(t) || j(t));
|
|
27
33
|
}
|
|
28
|
-
function
|
|
29
|
-
return !!(b(t) &&
|
|
34
|
+
function j(t) {
|
|
35
|
+
return !!(b(t) && u(t.toString));
|
|
30
36
|
}
|
|
31
37
|
function e(t) {
|
|
32
38
|
return typeof t == "number" && !isNaN(t);
|
|
33
39
|
}
|
|
34
|
-
function
|
|
40
|
+
function E(t) {
|
|
35
41
|
return e(t) && Number.isInteger(t);
|
|
36
42
|
}
|
|
37
|
-
function
|
|
43
|
+
function R(t) {
|
|
38
44
|
return e(t) && !Number.isInteger(t);
|
|
39
45
|
}
|
|
40
|
-
function
|
|
46
|
+
function _(t) {
|
|
41
47
|
return e(t) && t >= 0;
|
|
42
48
|
}
|
|
43
|
-
function
|
|
49
|
+
function w(t) {
|
|
44
50
|
return e(t) && t < 0;
|
|
45
51
|
}
|
|
46
52
|
function N(t) {
|
|
47
53
|
return typeof t == "boolean";
|
|
48
54
|
}
|
|
49
|
-
function
|
|
55
|
+
function u(t) {
|
|
50
56
|
return typeof t == "function";
|
|
51
57
|
}
|
|
52
|
-
function
|
|
58
|
+
function c(t) {
|
|
53
59
|
return typeof t > "u";
|
|
54
60
|
}
|
|
55
61
|
function d(t) {
|
|
@@ -58,108 +64,113 @@ function d(t) {
|
|
|
58
64
|
function i(t) {
|
|
59
65
|
return t === null;
|
|
60
66
|
}
|
|
61
|
-
function
|
|
67
|
+
function m(t) {
|
|
62
68
|
return t instanceof Map;
|
|
63
69
|
}
|
|
64
|
-
function
|
|
70
|
+
function O(t) {
|
|
65
71
|
return t instanceof Set;
|
|
66
72
|
}
|
|
67
|
-
function
|
|
68
|
-
return i(t) ||
|
|
73
|
+
function z(t) {
|
|
74
|
+
return i(t) || c(t) || o(t) ? !1 : u(
|
|
69
75
|
t[Symbol.iterator]
|
|
70
76
|
);
|
|
71
77
|
}
|
|
72
|
-
function
|
|
78
|
+
function B(t) {
|
|
73
79
|
return t instanceof WeakMap;
|
|
74
80
|
}
|
|
75
|
-
function
|
|
81
|
+
function D(t) {
|
|
76
82
|
return t instanceof WeakSet;
|
|
77
83
|
}
|
|
78
84
|
function A(t) {
|
|
79
|
-
return Number.isNaN(t) ? !0 : e(t) ? t === 0 :
|
|
85
|
+
return Number.isNaN(t) ? !0 : e(t) ? t === 0 : c(t) || i(t) ? !0 : N(t) ? t === !1 : o(t) ? t.trim() === "" : m(t) || O(t) ? t.size === 0 : y(t) ? t.length === 0 : b(t) ? Object.keys(t).length === 0 : !1;
|
|
80
86
|
}
|
|
81
|
-
function
|
|
87
|
+
function U(t) {
|
|
82
88
|
return !A(t);
|
|
83
89
|
}
|
|
84
|
-
function
|
|
85
|
-
return t === !1 || t === null ||
|
|
90
|
+
function V(t) {
|
|
91
|
+
return t === !1 || t === null || c(t) || t === 0 || t === "" || t === "0" ? !0 : y(t) ? t.length === 0 : b(t) ? Object.keys(t).length === 0 : !1;
|
|
86
92
|
}
|
|
87
93
|
const k = /^[ \t\n\r\v\f]*[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?[ \t\n\r\v\f]*$/;
|
|
88
|
-
function
|
|
94
|
+
function x(t) {
|
|
89
95
|
return typeof t == "number" ? !0 : o(t) ? k.test(t) : !1;
|
|
90
96
|
}
|
|
91
|
-
function
|
|
92
|
-
return i(t) || N(t) || e(t) || o(t) || d(t) ||
|
|
97
|
+
function M(t) {
|
|
98
|
+
return i(t) || N(t) || e(t) || o(t) || d(t) || c(t);
|
|
93
99
|
}
|
|
94
|
-
function
|
|
95
|
-
return !
|
|
100
|
+
function C(t) {
|
|
101
|
+
return !M(t);
|
|
96
102
|
}
|
|
97
|
-
function
|
|
103
|
+
function F(t) {
|
|
98
104
|
return e(t) && Number.isFinite(t);
|
|
99
105
|
}
|
|
100
|
-
function
|
|
106
|
+
function G(t) {
|
|
101
107
|
return Array.isArray(t);
|
|
102
108
|
}
|
|
103
|
-
function
|
|
109
|
+
function H(t) {
|
|
110
|
+
return y(t) || h(t) || m(t);
|
|
111
|
+
}
|
|
112
|
+
function p(t) {
|
|
104
113
|
if (o(t))
|
|
105
114
|
return t;
|
|
106
115
|
if (N(t))
|
|
107
116
|
return t ? "1" : "";
|
|
108
117
|
if (i(t))
|
|
109
118
|
return "";
|
|
110
|
-
if (
|
|
119
|
+
if (F(t)) {
|
|
111
120
|
const n = String(t);
|
|
112
121
|
return n.includes("e") ? null : n;
|
|
113
122
|
}
|
|
114
123
|
return null;
|
|
115
124
|
}
|
|
116
|
-
function
|
|
117
|
-
const f =
|
|
125
|
+
function I(t, n) {
|
|
126
|
+
const f = p(t), r = p(n);
|
|
118
127
|
return f !== null && r !== null ? f === r : t === n || typeof t == "number" && typeof n == "number" && Number.isNaN(t) && Number.isNaN(n);
|
|
119
128
|
}
|
|
120
|
-
function
|
|
129
|
+
function $(t) {
|
|
121
130
|
const n = /* @__PURE__ */ new Set(), f = [];
|
|
122
131
|
for (const r of t) {
|
|
123
|
-
const s =
|
|
132
|
+
const s = p(r);
|
|
124
133
|
i(s) ? f.push(r) : n.add(s);
|
|
125
134
|
}
|
|
126
135
|
return (r) => {
|
|
127
|
-
const s =
|
|
128
|
-
return i(s) ? f.some((
|
|
136
|
+
const s = p(r);
|
|
137
|
+
return i(s) ? f.some((g) => I(r, g)) : n.has(s);
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
140
|
export {
|
|
132
|
-
|
|
133
|
-
|
|
141
|
+
G as isAccessibleData,
|
|
142
|
+
y as isArray,
|
|
134
143
|
N as isBoolean,
|
|
135
144
|
A as isFalsy,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
F as isFiniteNumber,
|
|
146
|
+
R as isFloat,
|
|
147
|
+
u as isFunction,
|
|
148
|
+
E as isInteger,
|
|
149
|
+
z as isIterable,
|
|
150
|
+
m as isMap,
|
|
151
|
+
w as isNegativeNumber,
|
|
152
|
+
C as isNonPrimitive,
|
|
144
153
|
i as isNull,
|
|
145
154
|
e as isNumber,
|
|
146
155
|
b as isObject,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
V as
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
S as isObjectAny,
|
|
157
|
+
H as isPhpAccessible,
|
|
158
|
+
V as isPhpFalsy,
|
|
159
|
+
x as isPhpNumeric,
|
|
160
|
+
h as isPlainObject,
|
|
161
|
+
_ as isPositiveNumber,
|
|
162
|
+
M as isPrimitive,
|
|
163
|
+
T as isPrototypeObject,
|
|
164
|
+
O as isSet,
|
|
154
165
|
o as isString,
|
|
155
|
-
|
|
166
|
+
W as isStringable,
|
|
156
167
|
d as isSymbol,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
168
|
+
U as isTruthy,
|
|
169
|
+
P as isTruthyObject,
|
|
170
|
+
c as isUndefined,
|
|
171
|
+
B as isWeakMap,
|
|
172
|
+
D as isWeakSet,
|
|
173
|
+
j as objectToString,
|
|
174
|
+
I as phpValueMatch,
|
|
175
|
+
$ as phpValueMatcher
|
|
165
176
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,70 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { compareValues as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
1
|
+
import { arrayableItems as i, arrayableValues as t, castableToArray as s, cssListItemToString as o, getAccessibleValues as a, normalizeToArray as p, toArrayable as l, toJsonSerializable as n, toJsonable as y, toPhpKeyString as c } from "./cast.js";
|
|
2
|
+
import { compareValues as u, looseEqual as b, operatorMatch as h, strictEqual as f } from "./equality.js";
|
|
3
|
+
import { ItemNotFoundException as x, MultipleItemsFoundException as S } from "./exceptions.js";
|
|
4
|
+
import { isAccessibleData as A, isArray as N, isBoolean as F, isFalsy as I, isFiniteNumber as K, isFloat as d, isFunction as M, isInteger as T, isIterable as V, isMap as j, isNegativeNumber as v, isNonPrimitive as O, isNull as E, isNumber as k, isObject as L, isObjectAny as U, isPhpAccessible as q, isPhpFalsy as w, isPhpNumeric as z, isPlainObject as D, isPositiveNumber as J, isPrimitive as W, isPrototypeObject as B, isSet as C, isString as R, isStringable as G, isSymbol as H, isTruthy as Q, isTruthyObject as X, isUndefined as Y, isWeakMap as Z, isWeakSet as _, objectToString as $, phpValueMatch as ee, phpValueMatcher as re } from "./guards.js";
|
|
5
|
+
import { defineKey as te, entriesKeyValue as se, isIntegerLikeKey as oe, isPhpArrayKey as ae, isUnsafeKey as pe, keyedEntries as le, phpArrayKey as ne, reindexIntegerKeys as ye, renumberPhpIntegerKeys as ce } from "./keys.js";
|
|
6
|
+
import { resolveSliceRange as ue } from "./range.js";
|
|
7
|
+
import { phpTypeName as he, resolveDefault as fe, typeOf as ge } from "./reflect.js";
|
|
8
|
+
import { createSortSpecComparator as Se } from "./sorting.js";
|
|
9
|
+
import { arrayValueMessage as Ae, lowerFirst as Ne, toLower as Fe, toUpper as Ie, upperFirst as Ke } from "./string.js";
|
|
9
10
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
x as ItemNotFoundException,
|
|
12
|
+
S as MultipleItemsFoundException,
|
|
13
|
+
Ae as arrayValueMessage,
|
|
14
|
+
i as arrayableItems,
|
|
15
|
+
t as arrayableValues,
|
|
12
16
|
s as castableToArray,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
u as compareValues,
|
|
18
|
+
Se as createSortSpecComparator,
|
|
19
|
+
o as cssListItemToString,
|
|
20
|
+
te as defineKey,
|
|
21
|
+
se as entriesKeyValue,
|
|
18
22
|
a as getAccessibleValues,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
23
|
+
A as isAccessibleData,
|
|
24
|
+
N as isArray,
|
|
25
|
+
F as isBoolean,
|
|
26
|
+
I as isFalsy,
|
|
27
|
+
K as isFiniteNumber,
|
|
28
|
+
d as isFloat,
|
|
29
|
+
M as isFunction,
|
|
30
|
+
T as isInteger,
|
|
31
|
+
oe as isIntegerLikeKey,
|
|
32
|
+
V as isIterable,
|
|
33
|
+
j as isMap,
|
|
34
|
+
v as isNegativeNumber,
|
|
35
|
+
O as isNonPrimitive,
|
|
36
|
+
E as isNull,
|
|
37
|
+
k as isNumber,
|
|
38
|
+
L as isObject,
|
|
39
|
+
U as isObjectAny,
|
|
40
|
+
q as isPhpAccessible,
|
|
41
|
+
ae as isPhpArrayKey,
|
|
42
|
+
w as isPhpFalsy,
|
|
43
|
+
z as isPhpNumeric,
|
|
44
|
+
D as isPlainObject,
|
|
45
|
+
J as isPositiveNumber,
|
|
46
|
+
W as isPrimitive,
|
|
47
|
+
B as isPrototypeObject,
|
|
48
|
+
C as isSet,
|
|
49
|
+
R as isString,
|
|
50
|
+
G as isStringable,
|
|
51
|
+
H as isSymbol,
|
|
52
|
+
Q as isTruthy,
|
|
53
|
+
X as isTruthyObject,
|
|
54
|
+
Y as isUndefined,
|
|
55
|
+
pe as isUnsafeKey,
|
|
56
|
+
Z as isWeakMap,
|
|
57
|
+
_ as isWeakSet,
|
|
58
|
+
le as keyedEntries,
|
|
59
|
+
b as looseEqual,
|
|
60
|
+
Ne as lowerFirst,
|
|
61
|
+
p as normalizeToArray,
|
|
62
|
+
$ as objectToString,
|
|
63
|
+
h as operatorMatch,
|
|
64
|
+
ne as phpArrayKey,
|
|
65
|
+
he as phpTypeName,
|
|
66
|
+
ee as phpValueMatch,
|
|
67
|
+
re as phpValueMatcher,
|
|
68
|
+
ye as reindexIntegerKeys,
|
|
69
|
+
ce as renumberPhpIntegerKeys,
|
|
70
|
+
fe as resolveDefault,
|
|
71
|
+
ue as resolveSliceRange,
|
|
72
|
+
f as strictEqual,
|
|
63
73
|
l as toArrayable,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
n as toJsonSerializable,
|
|
75
|
+
y as toJsonable,
|
|
76
|
+
Fe as toLower,
|
|
77
|
+
c as toPhpKeyString,
|
|
78
|
+
Ie as toUpper,
|
|
79
|
+
ge as typeOf,
|
|
80
|
+
Ke as upperFirst
|
|
70
81
|
};
|
package/dist/keys.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Figures out if the entry key should be a number or a string.
|
|
3
3
|
*
|
|
4
|
+
* @deprecated Use `phpArrayKey` instead. This conversion is `Number()`/`parseFloat`, which is
|
|
5
|
+
* looser than PHP's: it turns `"01"` into `1`, `"1.5"` into `1.5` and `"0x10"` into `16`, keys
|
|
6
|
+
* PHP would all keep as strings. `phpArrayKey` converts only a canonical integer string, so a
|
|
7
|
+
* key handed to a callback is the key PHP stores. Kept because it is a published export.
|
|
8
|
+
*
|
|
4
9
|
* @param value - The entry key value (number, string, or symbol)
|
|
5
10
|
* @returns The entry key as a number if it can be converted, otherwise returns the original value
|
|
6
11
|
*/
|
|
@@ -32,6 +37,36 @@ export declare function isPhpArrayKey(value: unknown): value is string | number;
|
|
|
32
37
|
* @returns True if `key` is a canonical non-negative integer string
|
|
33
38
|
*/
|
|
34
39
|
export declare function isIntegerLikeKey(key: string): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The key PHP stores for an array key: a canonical decimal integer string
|
|
42
|
+
* becomes a number and any other string stays the same string; `null` becomes
|
|
43
|
+
* `""`, a boolean `0` or `1`, and a float is truncated toward zero (INF and NAN become `0`).
|
|
44
|
+
*
|
|
45
|
+
* @param key - The key, as `Object.keys` reports it or as a value used as an array offset
|
|
46
|
+
* @returns The key PHP would report
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* phpArrayKey("10"); -> 10
|
|
50
|
+
* phpArrayKey("01"); -> "01"
|
|
51
|
+
* phpArrayKey(true); -> 1
|
|
52
|
+
* phpArrayKey(1.5); -> 1
|
|
53
|
+
*/
|
|
54
|
+
export declare function phpArrayKey(key: unknown): string | number;
|
|
55
|
+
/**
|
|
56
|
+
* Get the entries of a plain object or a Map, each keyed by the string PHP stores for its key.
|
|
57
|
+
*
|
|
58
|
+
* A Map keeps its insertion order, which a plain object cannot hold for integer keys. Keys PHP
|
|
59
|
+
* stores as one (`1` and `"1"`) fold into the first one's place with the last one's value.
|
|
60
|
+
*
|
|
61
|
+
* @param data - The plain object or Map to read.
|
|
62
|
+
* @returns The `[key, value]` pairs in iteration order.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* keyedEntries({ b: 1, a: 2 }); -> [["b", 1], ["a", 2]]
|
|
66
|
+
* keyedEntries(new Map([[2, "c"], [0, "a"]])); -> [["2", "c"], ["0", "a"]]
|
|
67
|
+
* keyedEntries(new Map([[1, "a"], ["1", "b"]])); -> [["1", "b"]]
|
|
68
|
+
*/
|
|
69
|
+
export declare function keyedEntries<TValue = unknown>(data: object): [string, TValue][];
|
|
35
70
|
/**
|
|
36
71
|
* Renumber the integer-like keys in `entries` to a fresh 0-based sequence, in
|
|
37
72
|
* the order they appear; string keys pass through unchanged.
|
|
@@ -45,6 +80,14 @@ export declare function isIntegerLikeKey(key: string): boolean;
|
|
|
45
80
|
* @returns The same entries with integer-like keys renumbered from 0
|
|
46
81
|
*/
|
|
47
82
|
export declare function reindexIntegerKeys<TValue>(entries: [string, TValue][]): [string, TValue][];
|
|
83
|
+
/**
|
|
84
|
+
* Renumber every key PHP stores as an integer to a fresh 0-based sequence, in order, as `array_shift`,
|
|
85
|
+
* `array_splice` and `array_unshift` do. Unlike `reindexIntegerKeys`, a negative key such as "-1" counts too.
|
|
86
|
+
*
|
|
87
|
+
* @param entries - The entries to renumber, in their intended order
|
|
88
|
+
* @returns The same entries with every integer key renumbered from 0
|
|
89
|
+
*/
|
|
90
|
+
export declare function renumberPhpIntegerKeys<TValue>(entries: [string, TValue][]): [string, TValue][];
|
|
48
91
|
/**
|
|
49
92
|
* Define an own enumerable property on the target without going through a
|
|
50
93
|
* setter, so a key such as `__proto__` becomes a real own key rather than
|
package/dist/keys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,WAAW,EACjD,KAAK,EAAE,CAAC,GACT,CAAC,SAAS,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,CAAC,CAMpC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,GAAG,MAAM,CAatE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAkCzD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,MAAM,GAAG,OAAO,EACzC,IAAI,EAAE,MAAM,GACb,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAkBpB;AAYD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EACrC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAC5B,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAUpB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EACzC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAC5B,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAQpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,GAAG,EAAE,WAAW,EAChB,KAAK,EAAE,MAAM,GACd,IAAI,CAsBN"}
|
package/dist/keys.js
CHANGED
|
@@ -1,28 +1,66 @@
|
|
|
1
|
-
import { isPrototypeObject as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
1
|
+
import { isPrototypeObject as c, isString as s, isInteger as b, isMap as p, isNull as N, isUndefined as g, isBoolean as m, isNumber as o, isTruthyObject as a, isFunction as I, isSymbol as S } from "./guards.js";
|
|
2
|
+
const u = 2 ** 63;
|
|
3
|
+
function P(r) {
|
|
4
4
|
return !isNaN(Number(r)) && !isNaN(parseFloat(String(r))) ? Number(r) : r;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function h(r) {
|
|
7
7
|
return r === "__proto__" || r === "constructor" || r === "prototype";
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function O(r) {
|
|
10
|
+
return s(r) ? !0 : b(r) ? r >= -u && r < u : !1;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function K(r) {
|
|
13
13
|
return /^(0|[1-9]\d*)$/.test(r);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function f(r) {
|
|
16
|
+
if (s(r)) {
|
|
17
|
+
if (/^(0|-?[1-9]\d*)$/.test(r)) {
|
|
18
|
+
const n = Number(r);
|
|
19
|
+
if (Number.isSafeInteger(n))
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
return r;
|
|
23
|
+
}
|
|
24
|
+
if (N(r) || g(r))
|
|
25
|
+
return "";
|
|
26
|
+
if (m(r))
|
|
27
|
+
return r ? 1 : 0;
|
|
28
|
+
if (o(r) || Number.isNaN(r)) {
|
|
29
|
+
const n = Number.isFinite(r) ? BigInt.asIntN(64, BigInt(Math.trunc(r))) : 0n;
|
|
30
|
+
return Number.isSafeInteger(Number(n)) ? Number(n) : String(n);
|
|
31
|
+
}
|
|
32
|
+
return String(r);
|
|
33
|
+
}
|
|
34
|
+
function x(r) {
|
|
35
|
+
if (!p(r))
|
|
36
|
+
return Object.entries(r);
|
|
37
|
+
const n = /* @__PURE__ */ new Map();
|
|
38
|
+
for (const [t, e] of r) {
|
|
39
|
+
const i = d(t) ? String(f(t)) : void 0;
|
|
40
|
+
n.set(i ?? t, [i ?? String(t), e]);
|
|
41
|
+
}
|
|
42
|
+
return [...n.values()];
|
|
43
|
+
}
|
|
44
|
+
function d(r) {
|
|
45
|
+
return !a(r) && !I(r) && !S(r);
|
|
46
|
+
}
|
|
47
|
+
function _(r) {
|
|
48
|
+
let n = 0;
|
|
49
|
+
return r.map(([t, e]) => K(t) ? [String(n++), e] : [t, e]);
|
|
50
|
+
}
|
|
51
|
+
function j(r) {
|
|
52
|
+
let n = 0;
|
|
53
|
+
return r.map(
|
|
54
|
+
([t, e]) => o(f(t)) ? [String(n++), e] : [t, e]
|
|
55
|
+
);
|
|
18
56
|
}
|
|
19
|
-
function
|
|
20
|
-
if (!
|
|
21
|
-
if (Object.getOwnPropertyDescriptor(r,
|
|
22
|
-
r[
|
|
57
|
+
function B(r, n, t) {
|
|
58
|
+
if (!c(r)) {
|
|
59
|
+
if (Object.getOwnPropertyDescriptor(r, n)?.configurable === !1) {
|
|
60
|
+
r[n] = t;
|
|
23
61
|
return;
|
|
24
62
|
}
|
|
25
|
-
Object.defineProperty(r,
|
|
63
|
+
Object.defineProperty(r, n, {
|
|
26
64
|
value: t,
|
|
27
65
|
enumerable: !0,
|
|
28
66
|
writable: !0,
|
|
@@ -31,10 +69,13 @@ function m(r, e, t) {
|
|
|
31
69
|
}
|
|
32
70
|
}
|
|
33
71
|
export {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
72
|
+
B as defineKey,
|
|
73
|
+
P as entriesKeyValue,
|
|
74
|
+
K as isIntegerLikeKey,
|
|
75
|
+
O as isPhpArrayKey,
|
|
76
|
+
h as isUnsafeKey,
|
|
77
|
+
x as keyedEntries,
|
|
78
|
+
f as phpArrayKey,
|
|
79
|
+
_ as reindexIntegerKeys,
|
|
80
|
+
j as renumberPhpIntegerKeys
|
|
40
81
|
};
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.d.ts.map
CHANGED
|
@@ -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,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,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"}
|