esexts 1.2.5 → 1.2.7
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/esexts.es2018.js +1002 -0
- package/dist/esexts.es2018.umd.cjs +1 -0
- package/dist/esexts.js +442 -700
- package/dist/esexts.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/esexts.js
CHANGED
|
@@ -1,1111 +1,881 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
const l = Object.defineProperties, n = { enumerable: !1, configurable: !0, writable: !0 };
|
|
2
|
+
function p(t = { array: !1 }) {
|
|
3
|
+
return function(e = {}, ...r) {
|
|
4
|
+
const u = (i, s) => {
|
|
5
|
+
const o = Object.prototype.toString.call(i), f = Object.prototype.toString.call(s);
|
|
6
|
+
if (o !== f)
|
|
7
|
+
return s;
|
|
8
|
+
if (o === "[object Array]")
|
|
9
|
+
return t.array ? i.concat(...s) : s;
|
|
10
|
+
if (o === "[object Object]") {
|
|
11
|
+
for (const a in s)
|
|
12
|
+
i[a] = u(i[a], s[a]);
|
|
13
|
+
return i;
|
|
13
14
|
} else
|
|
14
|
-
return
|
|
15
|
+
return s;
|
|
15
16
|
};
|
|
16
|
-
for (const
|
|
17
|
-
|
|
18
|
-
return
|
|
17
|
+
for (const i of r)
|
|
18
|
+
e = u(e, i);
|
|
19
|
+
return e;
|
|
19
20
|
};
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
22
|
+
const b = p({ array: !1 }), d = p({ array: !0 });
|
|
23
|
+
l(Object, {
|
|
23
24
|
isObject: {
|
|
24
|
-
value: function(
|
|
25
|
-
return Object.prototype.toString.call(
|
|
25
|
+
value: function(t) {
|
|
26
|
+
return Object.prototype.toString.call(t) === "[object Object]";
|
|
26
27
|
},
|
|
27
|
-
|
|
28
|
-
configurable: !0,
|
|
29
|
-
writable: !0
|
|
28
|
+
...n
|
|
30
29
|
},
|
|
31
30
|
merge0: {
|
|
32
|
-
value: function(...
|
|
33
|
-
return
|
|
31
|
+
value: function(...t) {
|
|
32
|
+
return b(this, ...t);
|
|
34
33
|
},
|
|
35
|
-
|
|
36
|
-
configurable: !0,
|
|
37
|
-
writable: !0
|
|
34
|
+
...n
|
|
38
35
|
},
|
|
39
36
|
concat0: {
|
|
40
|
-
value: function(...
|
|
41
|
-
return
|
|
37
|
+
value: function(...t) {
|
|
38
|
+
return d(this, ...t);
|
|
42
39
|
},
|
|
43
|
-
|
|
44
|
-
configurable: !0,
|
|
45
|
-
writable: !0
|
|
40
|
+
...n
|
|
46
41
|
}
|
|
47
42
|
});
|
|
48
|
-
|
|
43
|
+
l(Object.prototype, {
|
|
49
44
|
clone0: {
|
|
50
45
|
value: function() {
|
|
51
46
|
return JSON.parse(JSON.stringify(this));
|
|
52
47
|
},
|
|
53
|
-
|
|
54
|
-
configurable: !0,
|
|
55
|
-
writable: !0
|
|
48
|
+
...n
|
|
56
49
|
},
|
|
57
50
|
length0: {
|
|
58
51
|
value: function() {
|
|
59
52
|
return Object.keys(this).length;
|
|
60
53
|
},
|
|
61
|
-
|
|
62
|
-
configurable: !0,
|
|
63
|
-
writable: !0
|
|
54
|
+
...n
|
|
64
55
|
},
|
|
65
56
|
entries0: {
|
|
66
57
|
value: function() {
|
|
67
58
|
return Object.entries(this);
|
|
68
59
|
},
|
|
69
|
-
|
|
70
|
-
configurable: !0,
|
|
71
|
-
writable: !0
|
|
60
|
+
...n
|
|
72
61
|
},
|
|
73
62
|
keys0: {
|
|
74
63
|
value: function() {
|
|
75
64
|
return Object.keys(this);
|
|
76
65
|
},
|
|
77
|
-
|
|
78
|
-
configurable: !0,
|
|
79
|
-
writable: !0
|
|
66
|
+
...n
|
|
80
67
|
},
|
|
81
68
|
values0: {
|
|
82
69
|
value: function() {
|
|
83
70
|
return Object.values(this);
|
|
84
71
|
},
|
|
85
|
-
|
|
86
|
-
configurable: !0,
|
|
87
|
-
writable: !0
|
|
72
|
+
...n
|
|
88
73
|
},
|
|
89
74
|
merge0: {
|
|
90
|
-
value: function(...
|
|
91
|
-
return
|
|
75
|
+
value: function(...t) {
|
|
76
|
+
return b(this, ...t);
|
|
92
77
|
},
|
|
93
|
-
|
|
94
|
-
configurable: !0,
|
|
95
|
-
writable: !0
|
|
78
|
+
...n
|
|
96
79
|
},
|
|
97
80
|
concat0: {
|
|
98
|
-
value: function(...
|
|
99
|
-
return
|
|
81
|
+
value: function(...t) {
|
|
82
|
+
return d(this, ...t);
|
|
100
83
|
},
|
|
101
|
-
|
|
102
|
-
configurable: !0,
|
|
103
|
-
writable: !0
|
|
84
|
+
...n
|
|
104
85
|
},
|
|
105
86
|
map0: {
|
|
106
|
-
value: function(
|
|
107
|
-
return Object.entries(this).map(([r, u]) =>
|
|
87
|
+
value: function(t = (r, u, i) => [r, u], e = 0) {
|
|
88
|
+
return Object.entries(this).map(([r, u]) => t(r, u, e++));
|
|
108
89
|
},
|
|
109
|
-
|
|
110
|
-
configurable: !0,
|
|
111
|
-
writable: !0
|
|
90
|
+
...n
|
|
112
91
|
},
|
|
113
92
|
pick0: {
|
|
114
|
-
value: function(...
|
|
115
|
-
const
|
|
116
|
-
for (const r of
|
|
117
|
-
|
|
118
|
-
return
|
|
93
|
+
value: function(...t) {
|
|
94
|
+
const e = {};
|
|
95
|
+
for (const r of t)
|
|
96
|
+
e[r] = this[r];
|
|
97
|
+
return e;
|
|
119
98
|
},
|
|
120
|
-
|
|
121
|
-
configurable: !0,
|
|
122
|
-
writable: !0
|
|
99
|
+
...n
|
|
123
100
|
},
|
|
124
101
|
omit0: {
|
|
125
|
-
value: function(...
|
|
126
|
-
const
|
|
102
|
+
value: function(...t) {
|
|
103
|
+
const e = {}, r = new Set(t);
|
|
127
104
|
for (const u in this)
|
|
128
|
-
r.has(u) || (
|
|
129
|
-
return
|
|
105
|
+
r.has(u) || (e[u] = this[u]);
|
|
106
|
+
return e;
|
|
130
107
|
},
|
|
131
|
-
|
|
132
|
-
configurable: !0,
|
|
133
|
-
writable: !0
|
|
108
|
+
...n
|
|
134
109
|
},
|
|
135
110
|
attr0: {
|
|
136
|
-
value: function(
|
|
137
|
-
return typeof this != "object" ? this : typeof
|
|
111
|
+
value: function(t, ...e) {
|
|
112
|
+
return typeof this != "object" ? this : typeof t == "function" ? t(this, ...e) : this[t];
|
|
138
113
|
},
|
|
139
|
-
|
|
140
|
-
configurable: !0,
|
|
141
|
-
writable: !0
|
|
114
|
+
...n
|
|
142
115
|
},
|
|
143
116
|
log0: {
|
|
144
|
-
value: function(...
|
|
145
|
-
return console.log(...
|
|
117
|
+
value: function(...t) {
|
|
118
|
+
return console.log(...t, this), this;
|
|
146
119
|
},
|
|
147
|
-
|
|
148
|
-
configurable: !0,
|
|
149
|
-
writable: !0
|
|
120
|
+
...n
|
|
150
121
|
},
|
|
151
122
|
debug0: {
|
|
152
|
-
value: function(...
|
|
153
|
-
return console.debug(...
|
|
123
|
+
value: function(...t) {
|
|
124
|
+
return console.debug(...t, this), this;
|
|
154
125
|
},
|
|
155
|
-
|
|
156
|
-
configurable: !0,
|
|
157
|
-
writable: !0
|
|
126
|
+
...n
|
|
158
127
|
},
|
|
159
128
|
// ====== Tree ======
|
|
160
129
|
getParents0: {
|
|
161
|
-
value: function(
|
|
162
|
-
const u =
|
|
163
|
-
let
|
|
164
|
-
for (;
|
|
165
|
-
u.push(
|
|
130
|
+
value: function(t = !1, e = -1, r = "parent") {
|
|
131
|
+
const u = t ? [this] : [];
|
|
132
|
+
let i = this[r];
|
|
133
|
+
for (; i && e-- != 0; )
|
|
134
|
+
u.push(i), i = i[r];
|
|
166
135
|
return u;
|
|
167
136
|
},
|
|
168
|
-
|
|
169
|
-
configurable: !0,
|
|
170
|
-
writable: !0
|
|
137
|
+
...n
|
|
171
138
|
},
|
|
172
139
|
getChildrens0: {
|
|
173
|
-
value: function(
|
|
174
|
-
const u = [],
|
|
175
|
-
if (
|
|
176
|
-
for (const
|
|
177
|
-
|
|
140
|
+
value: function(t = !1, e = -1, r = "children") {
|
|
141
|
+
const u = [], i = (s, o, f) => {
|
|
142
|
+
if (o && u.push(s), !(f == 0 || !s[r] || s[r].length == 0))
|
|
143
|
+
for (const a of s[r])
|
|
144
|
+
i(a, !0, f - 1);
|
|
178
145
|
};
|
|
179
|
-
return
|
|
146
|
+
return i(this, t, e), u;
|
|
180
147
|
},
|
|
181
|
-
|
|
182
|
-
configurable: !0,
|
|
183
|
-
writable: !0
|
|
148
|
+
...n
|
|
184
149
|
},
|
|
185
150
|
treeFind0: {
|
|
186
|
-
value: function(
|
|
187
|
-
if (
|
|
151
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
152
|
+
if (e && t(this))
|
|
188
153
|
return this;
|
|
189
154
|
if (r == 0 || !this[u] || this[u].length == 0)
|
|
190
155
|
return null;
|
|
191
|
-
for (const
|
|
192
|
-
const
|
|
193
|
-
if (
|
|
194
|
-
return
|
|
156
|
+
for (const i of this[u]) {
|
|
157
|
+
const s = i.treeFind0(t, !0, r - 1, u);
|
|
158
|
+
if (s !== null)
|
|
159
|
+
return s;
|
|
195
160
|
}
|
|
196
161
|
return null;
|
|
197
162
|
},
|
|
198
|
-
|
|
199
|
-
configurable: !0,
|
|
200
|
-
writable: !0
|
|
163
|
+
...n
|
|
201
164
|
},
|
|
202
165
|
treeEach0: {
|
|
203
|
-
value: function(
|
|
204
|
-
if (
|
|
205
|
-
for (const
|
|
206
|
-
|
|
166
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
167
|
+
if (e && t(this), !(r == 0 || !this[u] || this[u].length == 0)) {
|
|
168
|
+
for (const i of this[u])
|
|
169
|
+
i.treeEach0(t, !0, r - 1, u);
|
|
207
170
|
return this;
|
|
208
171
|
}
|
|
209
172
|
},
|
|
210
|
-
|
|
211
|
-
configurable: !0,
|
|
212
|
-
writable: !0
|
|
173
|
+
...n
|
|
213
174
|
},
|
|
214
175
|
treeMap0: {
|
|
215
|
-
value: function(
|
|
216
|
-
const
|
|
176
|
+
value: function(t, e = !0, r = -1, u = "children", i = null) {
|
|
177
|
+
const s = e ? t(this) : this, o = [];
|
|
217
178
|
if (r == 0 || !this[u] || this[u].length == 0)
|
|
218
|
-
return
|
|
179
|
+
return s;
|
|
219
180
|
for (const f of this[u])
|
|
220
|
-
|
|
221
|
-
return
|
|
181
|
+
o.push(f.treeMap0(t, !0, r - 1, u, i));
|
|
182
|
+
return s[u] = o, s;
|
|
222
183
|
},
|
|
223
|
-
|
|
224
|
-
configurable: !0,
|
|
225
|
-
writable: !0
|
|
184
|
+
...n
|
|
226
185
|
}
|
|
227
186
|
});
|
|
228
|
-
|
|
187
|
+
l(Number.prototype, {
|
|
229
188
|
ceil: {
|
|
230
189
|
value: function() {
|
|
231
190
|
return Math.ceil(this);
|
|
232
191
|
},
|
|
233
|
-
|
|
234
|
-
configurable: !0,
|
|
235
|
-
writable: !0
|
|
192
|
+
...n
|
|
236
193
|
},
|
|
237
194
|
floor: {
|
|
238
195
|
value: function() {
|
|
239
196
|
return Math.floor(this);
|
|
240
197
|
},
|
|
241
|
-
|
|
242
|
-
configurable: !0,
|
|
243
|
-
writable: !0
|
|
198
|
+
...n
|
|
244
199
|
},
|
|
245
200
|
round: {
|
|
246
|
-
value: function(
|
|
247
|
-
return
|
|
201
|
+
value: function(t = 0) {
|
|
202
|
+
return t == 0 ? Math.round(this) : Math.round(this * 10 ** t) / 10 ** t;
|
|
248
203
|
},
|
|
249
|
-
|
|
250
|
-
configurable: !0,
|
|
251
|
-
writable: !0
|
|
204
|
+
...n
|
|
252
205
|
},
|
|
253
206
|
trunc: {
|
|
254
207
|
value: function() {
|
|
255
208
|
return Math.trunc(this);
|
|
256
209
|
},
|
|
257
|
-
|
|
258
|
-
configurable: !0,
|
|
259
|
-
writable: !0
|
|
210
|
+
...n
|
|
260
211
|
},
|
|
261
212
|
abs: {
|
|
262
213
|
value: function() {
|
|
263
214
|
return Math.abs(this);
|
|
264
215
|
},
|
|
265
|
-
|
|
266
|
-
configurable: !0,
|
|
267
|
-
writable: !0
|
|
216
|
+
...n
|
|
268
217
|
},
|
|
269
218
|
max: {
|
|
270
|
-
value: function(...
|
|
271
|
-
return Math.max(this, ...
|
|
219
|
+
value: function(...t) {
|
|
220
|
+
return Math.max(this, ...t);
|
|
272
221
|
},
|
|
273
|
-
|
|
274
|
-
configurable: !0,
|
|
275
|
-
writable: !0
|
|
222
|
+
...n
|
|
276
223
|
},
|
|
277
224
|
min: {
|
|
278
|
-
value: function(...
|
|
279
|
-
return Math.min(this, ...
|
|
225
|
+
value: function(...t) {
|
|
226
|
+
return Math.min(this, ...t);
|
|
280
227
|
},
|
|
281
|
-
|
|
282
|
-
configurable: !0,
|
|
283
|
-
writable: !0
|
|
228
|
+
...n
|
|
284
229
|
},
|
|
285
230
|
baseConvert: {
|
|
286
|
-
value: function(
|
|
287
|
-
let
|
|
231
|
+
value: function(t = 64) {
|
|
232
|
+
let e = "", r = this, u = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
288
233
|
for (; r > 0; )
|
|
289
|
-
|
|
290
|
-
return
|
|
234
|
+
e = u.at(r % t) + e, r = Math.floor(r / t);
|
|
235
|
+
return e || "0";
|
|
291
236
|
},
|
|
292
|
-
|
|
293
|
-
configurable: !0,
|
|
294
|
-
writable: !0
|
|
237
|
+
...n
|
|
295
238
|
},
|
|
296
239
|
toFixed0: {
|
|
297
|
-
value: function(...
|
|
298
|
-
return +this.toFixed(...
|
|
240
|
+
value: function(...t) {
|
|
241
|
+
return +this.toFixed(...t);
|
|
299
242
|
},
|
|
300
|
-
|
|
301
|
-
configurable: !0,
|
|
302
|
-
writable: !0
|
|
243
|
+
...n
|
|
303
244
|
},
|
|
304
245
|
toDate: {
|
|
305
246
|
value: function() {
|
|
306
247
|
return Date.new(this);
|
|
307
248
|
},
|
|
308
|
-
|
|
309
|
-
configurable: !0,
|
|
310
|
-
writable: !0
|
|
249
|
+
...n
|
|
311
250
|
}
|
|
312
251
|
});
|
|
313
|
-
|
|
252
|
+
l(BigInt.prototype, {
|
|
314
253
|
toJSON: {
|
|
315
254
|
value: function() {
|
|
316
255
|
return this > 9007199254740991n || this < -9007199254740991n ? this.toString() : Number(this);
|
|
317
256
|
},
|
|
318
|
-
|
|
319
|
-
configurable: !0,
|
|
320
|
-
writable: !0
|
|
257
|
+
...n
|
|
321
258
|
}
|
|
322
259
|
});
|
|
323
|
-
|
|
260
|
+
l(String.prototype, {
|
|
324
261
|
length0: {
|
|
325
262
|
value: function() {
|
|
326
263
|
return this.length;
|
|
327
264
|
},
|
|
328
|
-
|
|
329
|
-
configurable: !0,
|
|
330
|
-
writable: !0
|
|
265
|
+
...n
|
|
331
266
|
},
|
|
332
267
|
substring0: {
|
|
333
|
-
value: function(
|
|
334
|
-
return
|
|
268
|
+
value: function(t = 0, e = this.length) {
|
|
269
|
+
return t = t >= 0 ? t : this.length + t, e = e >= 0 ? e : this.length + e, this.substring(t, e);
|
|
335
270
|
},
|
|
336
|
-
|
|
337
|
-
configurable: !0,
|
|
338
|
-
writable: !0
|
|
271
|
+
...n
|
|
339
272
|
},
|
|
340
273
|
substr0: {
|
|
341
|
-
value: function(
|
|
342
|
-
return
|
|
274
|
+
value: function(t = 0, e = this.length) {
|
|
275
|
+
return t = t >= 0 ? t : this.length + t, e = t + e, this.substring(t, e);
|
|
343
276
|
},
|
|
344
|
-
|
|
345
|
-
configurable: !0,
|
|
346
|
-
writable: !0
|
|
277
|
+
...n
|
|
347
278
|
},
|
|
348
279
|
split0: {
|
|
349
|
-
value: function(
|
|
350
|
-
const r = this ? this.split(
|
|
351
|
-
return
|
|
280
|
+
value: function(t = ",", e = -1) {
|
|
281
|
+
const r = this ? this.split(t) : [];
|
|
282
|
+
return e === -1 ? r : r.push0(r.splice(e - 1).join(t));
|
|
352
283
|
},
|
|
353
|
-
|
|
354
|
-
configurable: !0,
|
|
355
|
-
writable: !0
|
|
284
|
+
...n
|
|
356
285
|
},
|
|
357
286
|
splitNumber: {
|
|
358
|
-
value: function(
|
|
359
|
-
return this.split0(
|
|
287
|
+
value: function(t = ",") {
|
|
288
|
+
return this.split0(t).map((e) => +e);
|
|
360
289
|
},
|
|
361
|
-
|
|
362
|
-
configurable: !0,
|
|
363
|
-
writable: !0
|
|
290
|
+
...n
|
|
364
291
|
},
|
|
365
292
|
splitSegment: {
|
|
366
|
-
value: function(
|
|
367
|
-
const
|
|
368
|
-
for (let r = 0; r < this.length; r +=
|
|
369
|
-
|
|
370
|
-
return
|
|
293
|
+
value: function(t = 1) {
|
|
294
|
+
const e = [];
|
|
295
|
+
for (let r = 0; r < this.length; r += t)
|
|
296
|
+
e.push(this.substring(r, t));
|
|
297
|
+
return e;
|
|
371
298
|
},
|
|
372
|
-
|
|
373
|
-
configurable: !0,
|
|
374
|
-
writable: !0
|
|
299
|
+
...n
|
|
375
300
|
},
|
|
376
301
|
sprintf: {
|
|
377
|
-
value: function(...
|
|
378
|
-
let [
|
|
302
|
+
value: function(...t) {
|
|
303
|
+
let [e, ...r] = this.split(/%[sd]/);
|
|
379
304
|
for (let u = 0; u < r.length; u++)
|
|
380
|
-
|
|
381
|
-
return
|
|
305
|
+
e += t[u] + r[u];
|
|
306
|
+
return e;
|
|
382
307
|
},
|
|
383
|
-
|
|
384
|
-
configurable: !0,
|
|
385
|
-
writable: !0
|
|
308
|
+
...n
|
|
386
309
|
},
|
|
387
310
|
subOf: {
|
|
388
|
-
value: function(
|
|
389
|
-
for (let
|
|
390
|
-
u = this.indexOf(
|
|
391
|
-
let
|
|
392
|
-
return
|
|
311
|
+
value: function(t, e, r = 0, u = 0) {
|
|
312
|
+
for (let o = 0; o < r && u != -1; o++, u++)
|
|
313
|
+
u = this.indexOf(t, u);
|
|
314
|
+
let i = this.indexOf(t, u), s = this.indexOf(e, i);
|
|
315
|
+
return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
|
|
393
316
|
},
|
|
394
|
-
|
|
395
|
-
configurable: !0,
|
|
396
|
-
writable: !0
|
|
317
|
+
...n
|
|
397
318
|
},
|
|
398
319
|
lastSubOf: {
|
|
399
|
-
value: function(
|
|
400
|
-
for (let
|
|
401
|
-
u = this.lastIndexOf(
|
|
402
|
-
let
|
|
403
|
-
return
|
|
320
|
+
value: function(t, e, r = 0, u = 1 / 0) {
|
|
321
|
+
for (let o = 0; o < r && u != -1; o++, u--)
|
|
322
|
+
u = this.lastIndexOf(t, u);
|
|
323
|
+
let i = this.lastIndexOf(t, u), s = this.indexOf(e, i);
|
|
324
|
+
return i == -1 || s == -1 ? "" : (i += t.length, this.substring(i, s));
|
|
404
325
|
},
|
|
405
|
-
|
|
406
|
-
configurable: !0,
|
|
407
|
-
writable: !0
|
|
326
|
+
...n
|
|
408
327
|
},
|
|
409
328
|
camel2under: {
|
|
410
329
|
value: function() {
|
|
411
|
-
return this.substr(0, 1).toLowerCase() + this.substr(1).replace(/([A-Z])/g, (
|
|
330
|
+
return this.substr(0, 1).toLowerCase() + this.substr(1).replace(/([A-Z])/g, (t, e) => "_" + e.toLowerCase());
|
|
412
331
|
},
|
|
413
|
-
|
|
414
|
-
configurable: !0,
|
|
415
|
-
writable: !0
|
|
332
|
+
...n
|
|
416
333
|
},
|
|
417
334
|
under2camel: {
|
|
418
335
|
value: function() {
|
|
419
|
-
return this.replace(/_([a-z])/g, (
|
|
336
|
+
return this.replace(/_([a-z])/g, (t, e) => e.toUpperCase());
|
|
420
337
|
},
|
|
421
|
-
|
|
422
|
-
configurable: !0,
|
|
423
|
-
writable: !0
|
|
338
|
+
...n
|
|
424
339
|
},
|
|
425
340
|
camel2pascal: {
|
|
426
341
|
value: function() {
|
|
427
342
|
return this.substr(0, 1).toUpperCase() + this.substr(1);
|
|
428
343
|
},
|
|
429
|
-
|
|
430
|
-
configurable: !0,
|
|
431
|
-
writable: !0
|
|
344
|
+
...n
|
|
432
345
|
},
|
|
433
346
|
pascal2camel: {
|
|
434
347
|
value: function() {
|
|
435
348
|
return this.substr(0, 1).toLowerCase() + this.substr(1);
|
|
436
349
|
},
|
|
437
|
-
|
|
438
|
-
configurable: !0,
|
|
439
|
-
writable: !0
|
|
350
|
+
...n
|
|
440
351
|
},
|
|
441
352
|
under2kebab: {
|
|
442
353
|
value: function() {
|
|
443
354
|
return this.replace(/_/g, "-");
|
|
444
355
|
},
|
|
445
|
-
|
|
446
|
-
configurable: !0,
|
|
447
|
-
writable: !0
|
|
356
|
+
...n
|
|
448
357
|
},
|
|
449
358
|
kebab2under: {
|
|
450
359
|
value: function() {
|
|
451
360
|
return this.replace(/-/g, "_");
|
|
452
361
|
},
|
|
453
|
-
|
|
454
|
-
configurable: !0,
|
|
455
|
-
writable: !0
|
|
362
|
+
...n
|
|
456
363
|
},
|
|
457
364
|
baseConvert: {
|
|
458
|
-
value: function(
|
|
459
|
-
let
|
|
365
|
+
value: function(t = 64) {
|
|
366
|
+
let e = 0, r = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-";
|
|
460
367
|
for (let u = 0; u < this.length; u++)
|
|
461
|
-
|
|
462
|
-
return
|
|
368
|
+
e = e * t + r.indexOf(this.at(u));
|
|
369
|
+
return e;
|
|
463
370
|
},
|
|
464
|
-
|
|
465
|
-
configurable: !0,
|
|
466
|
-
writable: !0
|
|
371
|
+
...n
|
|
467
372
|
},
|
|
468
373
|
toFixed0: {
|
|
469
|
-
value: function(...
|
|
470
|
-
return +(+this).toFixed(...
|
|
374
|
+
value: function(...t) {
|
|
375
|
+
return +(+this).toFixed(...t);
|
|
471
376
|
},
|
|
472
|
-
|
|
473
|
-
configurable: !0,
|
|
474
|
-
writable: !0
|
|
377
|
+
...n
|
|
475
378
|
},
|
|
476
379
|
toDate: {
|
|
477
380
|
value: function() {
|
|
478
381
|
return Date.new(this);
|
|
479
382
|
},
|
|
480
|
-
|
|
481
|
-
configurable: !0,
|
|
482
|
-
writable: !0
|
|
383
|
+
...n
|
|
483
384
|
},
|
|
484
385
|
hex2bytes: {
|
|
485
386
|
value: function() {
|
|
486
|
-
const
|
|
487
|
-
for (let
|
|
488
|
-
|
|
489
|
-
return
|
|
387
|
+
const t = [];
|
|
388
|
+
for (let e = 0; e < this.length; e += 2)
|
|
389
|
+
t.push(Number.parseInt(this.substring(e, e + 2), 16));
|
|
390
|
+
return t;
|
|
490
391
|
},
|
|
491
|
-
|
|
492
|
-
configurable: !0,
|
|
493
|
-
writable: !0
|
|
392
|
+
...n
|
|
494
393
|
},
|
|
495
394
|
string2bytes: {
|
|
496
395
|
value: function() {
|
|
497
396
|
if (typeof TextEncoder < "u")
|
|
498
397
|
return Array.from(new TextEncoder().encode(this));
|
|
499
|
-
const
|
|
500
|
-
for (let r = 0; r <
|
|
501
|
-
|
|
502
|
-
return
|
|
398
|
+
const t = [], e = encodeURIComponent(this);
|
|
399
|
+
for (let r = 0; r < e.length; )
|
|
400
|
+
t.push(e.charAt(r) == "%" ? Number.parseInt(e.substring(r + 1, r += 3), 16) : e.charCodeAt(r++));
|
|
401
|
+
return t;
|
|
503
402
|
},
|
|
504
|
-
|
|
505
|
-
configurable: !0,
|
|
506
|
-
writable: !0
|
|
403
|
+
...n
|
|
507
404
|
},
|
|
508
405
|
base64decode: {
|
|
509
|
-
value: function(
|
|
510
|
-
const
|
|
511
|
-
for (let
|
|
512
|
-
r[u.charAt(
|
|
513
|
-
const
|
|
514
|
-
for (let
|
|
515
|
-
const
|
|
516
|
-
|
|
406
|
+
value: function(t) {
|
|
407
|
+
const e = [], r = {}, u = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
408
|
+
for (let s = 0; s < u.length; s++)
|
|
409
|
+
r[u.charAt(s)] = s;
|
|
410
|
+
const i = this.charAt(this.length - 1) != "=" ? this.length : this.charAt(this.length - 2) != "=" ? this.length - 1 : this.length - 2;
|
|
411
|
+
for (let s = 3; s < i; s += 4) {
|
|
412
|
+
const o = (r[this.charAt(s - 3)] << 18) + (r[this.charAt(s - 2)] << 12) + (r[this.charAt(s - 1)] << 6) + r[this.charAt(s)];
|
|
413
|
+
e.push((o & 16711680) >> 16, (o & 65280) >> 8, o & 255);
|
|
517
414
|
}
|
|
518
|
-
if (
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
} else if (
|
|
522
|
-
const
|
|
523
|
-
|
|
415
|
+
if (i % 4 == 3) {
|
|
416
|
+
const s = (r[this.charAt(i - 3)] << 18) + (r[this.charAt(i - 2)] << 12) + (r[this.charAt(i - 1)] << 6);
|
|
417
|
+
e.push((s & 16711680) >> 16, (s & 65280) >> 8);
|
|
418
|
+
} else if (i % 4 == 2) {
|
|
419
|
+
const s = (r[this.charAt(i - 2)] << 18) + (r[this.charAt(i - 1)] << 12);
|
|
420
|
+
e.push((s & 16711680) >> 16);
|
|
524
421
|
}
|
|
525
|
-
return
|
|
422
|
+
return e;
|
|
526
423
|
},
|
|
527
|
-
|
|
528
|
-
configurable: !0,
|
|
529
|
-
writable: !0
|
|
424
|
+
...n
|
|
530
425
|
}
|
|
531
426
|
});
|
|
532
|
-
typeof Iterator < "u" &&
|
|
427
|
+
typeof Iterator < "u" && l(Iterator.prototype, {
|
|
533
428
|
toArray: {
|
|
534
429
|
value: function() {
|
|
535
430
|
return Array.from(this);
|
|
536
431
|
},
|
|
537
|
-
|
|
538
|
-
configurable: !0,
|
|
539
|
-
writable: !0
|
|
432
|
+
...n
|
|
540
433
|
}
|
|
541
434
|
});
|
|
542
|
-
|
|
435
|
+
l(Array.prototype, {
|
|
543
436
|
length0: {
|
|
544
437
|
value: function() {
|
|
545
438
|
return this.length;
|
|
546
439
|
},
|
|
547
|
-
|
|
548
|
-
configurable: !0,
|
|
549
|
-
writable: !0
|
|
440
|
+
...n
|
|
550
441
|
},
|
|
551
442
|
entries0: {
|
|
552
443
|
value: function() {
|
|
553
444
|
return this.entries();
|
|
554
445
|
},
|
|
555
|
-
|
|
556
|
-
configurable: !0,
|
|
557
|
-
writable: !0
|
|
446
|
+
...n
|
|
558
447
|
},
|
|
559
448
|
push0: {
|
|
560
|
-
value: function(...
|
|
561
|
-
return this.push(...
|
|
449
|
+
value: function(...t) {
|
|
450
|
+
return this.push(...t), this;
|
|
562
451
|
},
|
|
563
|
-
|
|
564
|
-
configurable: !0,
|
|
565
|
-
writable: !0
|
|
452
|
+
...n
|
|
566
453
|
},
|
|
567
454
|
push1: {
|
|
568
|
-
value: function(...
|
|
569
|
-
return this.push(...
|
|
455
|
+
value: function(...t) {
|
|
456
|
+
return this.push(...t), t[0];
|
|
570
457
|
},
|
|
571
|
-
|
|
572
|
-
configurable: !0,
|
|
573
|
-
writable: !0
|
|
458
|
+
...n
|
|
574
459
|
},
|
|
575
460
|
push3: {
|
|
576
|
-
value: function(...
|
|
577
|
-
return this.push(...
|
|
461
|
+
value: function(...t) {
|
|
462
|
+
return this.push(...t), t;
|
|
578
463
|
},
|
|
579
|
-
|
|
580
|
-
configurable: !0,
|
|
581
|
-
writable: !0
|
|
464
|
+
...n
|
|
582
465
|
},
|
|
583
466
|
pop0: {
|
|
584
|
-
value: function(...
|
|
585
|
-
return this.pop(...
|
|
467
|
+
value: function(...t) {
|
|
468
|
+
return this.pop(...t), this;
|
|
586
469
|
},
|
|
587
|
-
|
|
588
|
-
configurable: !0,
|
|
589
|
-
writable: !0
|
|
470
|
+
...n
|
|
590
471
|
},
|
|
591
472
|
pop1: {
|
|
592
|
-
value: function(...
|
|
593
|
-
return this.pop(...
|
|
473
|
+
value: function(...t) {
|
|
474
|
+
return this.pop(...t), t[0];
|
|
594
475
|
},
|
|
595
|
-
|
|
596
|
-
configurable: !0,
|
|
597
|
-
writable: !0
|
|
476
|
+
...n
|
|
598
477
|
},
|
|
599
478
|
pop3: {
|
|
600
|
-
value: function(...
|
|
601
|
-
return this.pop(...
|
|
479
|
+
value: function(...t) {
|
|
480
|
+
return this.pop(...t), t;
|
|
602
481
|
},
|
|
603
|
-
|
|
604
|
-
configurable: !0,
|
|
605
|
-
writable: !0
|
|
482
|
+
...n
|
|
606
483
|
},
|
|
607
484
|
unshift0: {
|
|
608
|
-
value: function(...
|
|
609
|
-
return this.unshift(...
|
|
485
|
+
value: function(...t) {
|
|
486
|
+
return this.unshift(...t), this;
|
|
610
487
|
},
|
|
611
|
-
|
|
612
|
-
configurable: !0,
|
|
613
|
-
writable: !0
|
|
488
|
+
...n
|
|
614
489
|
},
|
|
615
490
|
unshift1: {
|
|
616
|
-
value: function(...
|
|
617
|
-
return this.unshift(...
|
|
491
|
+
value: function(...t) {
|
|
492
|
+
return this.unshift(...t), t[0];
|
|
618
493
|
},
|
|
619
|
-
|
|
620
|
-
configurable: !0,
|
|
621
|
-
writable: !0
|
|
494
|
+
...n
|
|
622
495
|
},
|
|
623
496
|
unshift3: {
|
|
624
|
-
value: function(...
|
|
625
|
-
return this.unshift(...
|
|
497
|
+
value: function(...t) {
|
|
498
|
+
return this.unshift(...t), t;
|
|
626
499
|
},
|
|
627
|
-
|
|
628
|
-
configurable: !0,
|
|
629
|
-
writable: !0
|
|
500
|
+
...n
|
|
630
501
|
},
|
|
631
502
|
shift0: {
|
|
632
|
-
value: function(...
|
|
633
|
-
return this.shift(...
|
|
503
|
+
value: function(...t) {
|
|
504
|
+
return this.shift(...t), this;
|
|
634
505
|
},
|
|
635
|
-
|
|
636
|
-
configurable: !0,
|
|
637
|
-
writable: !0
|
|
506
|
+
...n
|
|
638
507
|
},
|
|
639
508
|
shift1: {
|
|
640
|
-
value: function(...
|
|
641
|
-
return this.shift(...
|
|
509
|
+
value: function(...t) {
|
|
510
|
+
return this.shift(...t), t[0];
|
|
642
511
|
},
|
|
643
|
-
|
|
644
|
-
configurable: !0,
|
|
645
|
-
writable: !0
|
|
512
|
+
...n
|
|
646
513
|
},
|
|
647
514
|
shift3: {
|
|
648
|
-
value: function(...
|
|
649
|
-
return this.shift(...
|
|
515
|
+
value: function(...t) {
|
|
516
|
+
return this.shift(...t), t;
|
|
650
517
|
},
|
|
651
|
-
|
|
652
|
-
configurable: !0,
|
|
653
|
-
writable: !0
|
|
518
|
+
...n
|
|
654
519
|
},
|
|
655
520
|
first0: {
|
|
656
|
-
value: function(
|
|
657
|
-
return this.length ? this[0] :
|
|
521
|
+
value: function(t = null) {
|
|
522
|
+
return this.length ? this[0] : t;
|
|
658
523
|
},
|
|
659
|
-
|
|
660
|
-
configurable: !0,
|
|
661
|
-
writable: !0
|
|
524
|
+
...n
|
|
662
525
|
},
|
|
663
526
|
last0: {
|
|
664
|
-
value: function(
|
|
665
|
-
return this.length ? this[this.length - 1] :
|
|
527
|
+
value: function(t = null) {
|
|
528
|
+
return this.length ? this[this.length - 1] : t;
|
|
666
529
|
},
|
|
667
|
-
|
|
668
|
-
configurable: !0,
|
|
669
|
-
writable: !0
|
|
530
|
+
...n
|
|
670
531
|
},
|
|
671
532
|
find0: {
|
|
672
|
-
value: function(
|
|
673
|
-
return this.find(
|
|
533
|
+
value: function(t, e = null) {
|
|
534
|
+
return this.find(t) ?? e;
|
|
674
535
|
},
|
|
675
|
-
|
|
676
|
-
configurable: !0,
|
|
677
|
-
writable: !0
|
|
536
|
+
...n
|
|
678
537
|
},
|
|
679
538
|
equals0: {
|
|
680
|
-
value: function(
|
|
681
|
-
return this.length ===
|
|
539
|
+
value: function(t) {
|
|
540
|
+
return this.length === t.length && (this === t || this.length === 0 || this.every((e, r) => e === t[r]));
|
|
682
541
|
},
|
|
683
|
-
|
|
684
|
-
configurable: !0,
|
|
685
|
-
writable: !0
|
|
542
|
+
...n
|
|
686
543
|
},
|
|
687
544
|
unique0: {
|
|
688
|
-
value: function(
|
|
689
|
-
const
|
|
690
|
-
return this.filter((r) =>
|
|
545
|
+
value: function(t = (e) => e) {
|
|
546
|
+
const e = /* @__PURE__ */ new Set();
|
|
547
|
+
return this.filter((r) => e.has(t(r)) ? !1 : !!e.add(t(r)));
|
|
691
548
|
},
|
|
692
|
-
|
|
693
|
-
configurable: !0,
|
|
694
|
-
writable: !0
|
|
549
|
+
...n
|
|
695
550
|
},
|
|
696
551
|
each0: {
|
|
697
|
-
value: function(
|
|
698
|
-
return this.forEach(
|
|
552
|
+
value: function(t) {
|
|
553
|
+
return this.forEach(t), this;
|
|
699
554
|
},
|
|
700
|
-
|
|
701
|
-
configurable: !0,
|
|
702
|
-
writable: !0
|
|
555
|
+
...n
|
|
703
556
|
},
|
|
704
557
|
toObject: {
|
|
705
|
-
value: function(
|
|
706
|
-
return Object.fromEntries(this.map(
|
|
558
|
+
value: function(t = (e, r) => [r, e]) {
|
|
559
|
+
return Object.fromEntries(this.map(t));
|
|
707
560
|
},
|
|
708
|
-
|
|
709
|
-
configurable: !0,
|
|
710
|
-
writable: !0
|
|
561
|
+
...n
|
|
711
562
|
},
|
|
712
563
|
toMap: {
|
|
713
|
-
value: function(
|
|
714
|
-
return new Map(this.map(
|
|
564
|
+
value: function(t = (e, r) => [r, e]) {
|
|
565
|
+
return new Map(this.map(t));
|
|
715
566
|
},
|
|
716
|
-
|
|
717
|
-
configurable: !0,
|
|
718
|
-
writable: !0
|
|
567
|
+
...n
|
|
719
568
|
},
|
|
720
569
|
toSet: {
|
|
721
570
|
value: function() {
|
|
722
571
|
return new Set(this);
|
|
723
572
|
},
|
|
724
|
-
|
|
725
|
-
configurable: !0,
|
|
726
|
-
writable: !0
|
|
573
|
+
...n
|
|
727
574
|
},
|
|
728
575
|
toGroup: {
|
|
729
|
-
value: function(
|
|
730
|
-
const
|
|
576
|
+
value: function(t = (e) => [e.id, e]) {
|
|
577
|
+
const e = {};
|
|
731
578
|
for (const r of this) {
|
|
732
|
-
const [u,
|
|
733
|
-
u in
|
|
579
|
+
const [u, i] = t(r);
|
|
580
|
+
u in e || (e[u] = []), e[u].push(i);
|
|
734
581
|
}
|
|
735
|
-
return
|
|
582
|
+
return e;
|
|
736
583
|
},
|
|
737
|
-
|
|
738
|
-
configurable: !0,
|
|
739
|
-
writable: !0
|
|
584
|
+
...n
|
|
740
585
|
},
|
|
741
586
|
toMerge: {
|
|
742
|
-
value: function(
|
|
587
|
+
value: function(t = (u) => u.id, e = (u) => ({ ...u, children: u.children || [] }), r = (u, i) => u.children.push(i)) {
|
|
743
588
|
const u = [];
|
|
744
|
-
for (const
|
|
745
|
-
r(u.find((
|
|
589
|
+
for (const i of this)
|
|
590
|
+
r(u.find((s) => t(s) == t(i)) ?? u.push1(e(i)), i);
|
|
746
591
|
return u;
|
|
747
592
|
},
|
|
748
|
-
|
|
749
|
-
configurable: !0,
|
|
750
|
-
writable: !0
|
|
593
|
+
...n
|
|
751
594
|
},
|
|
752
595
|
bytes2hex: {
|
|
753
596
|
value: function() {
|
|
754
|
-
let
|
|
755
|
-
for (let
|
|
756
|
-
|
|
757
|
-
return
|
|
597
|
+
let t = "";
|
|
598
|
+
for (let e = 0; e < this.length; e++)
|
|
599
|
+
t += (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
600
|
+
return t;
|
|
758
601
|
},
|
|
759
|
-
|
|
760
|
-
configurable: !0,
|
|
761
|
-
writable: !0
|
|
602
|
+
...n
|
|
762
603
|
},
|
|
763
604
|
bytes2string: {
|
|
764
605
|
value: function() {
|
|
765
606
|
if (typeof TextDecoder < "u")
|
|
766
607
|
return new TextDecoder().decode(new Uint8Array(this));
|
|
767
|
-
let
|
|
768
|
-
for (let
|
|
769
|
-
|
|
770
|
-
return decodeURIComponent(
|
|
608
|
+
let t = "";
|
|
609
|
+
for (let e = 0; e < this.length; e++)
|
|
610
|
+
t += "%" + (this[e] < 16 ? "0" : "") + this[e].toString(16);
|
|
611
|
+
return decodeURIComponent(t);
|
|
771
612
|
},
|
|
772
|
-
|
|
773
|
-
configurable: !0,
|
|
774
|
-
writable: !0
|
|
613
|
+
...n
|
|
775
614
|
},
|
|
776
615
|
base64encode: {
|
|
777
|
-
value: function(
|
|
778
|
-
let r = "", u =
|
|
779
|
-
for (let
|
|
780
|
-
const
|
|
781
|
-
r += u.charAt((
|
|
616
|
+
value: function(t = !1, e = !0) {
|
|
617
|
+
let r = "", u = t === !0 ? "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
618
|
+
for (let i = 2; i < this.length; i += 3) {
|
|
619
|
+
const s = (this[i - 2] << 16) + (this[i - 1] << 8) + this[i];
|
|
620
|
+
r += u.charAt((s & 16515072) >> 18) + u.charAt((s & 258048) >> 12) + u.charAt((s & 4032) >> 6) + u.charAt(s & 63);
|
|
782
621
|
}
|
|
783
622
|
if (this.length % 3 == 2) {
|
|
784
|
-
const
|
|
785
|
-
r += u.charAt((
|
|
623
|
+
const i = (this[this.length - 2] << 16) + (this[this.length - 1] << 8);
|
|
624
|
+
r += u.charAt((i & 16515072) >> 18) + u.charAt((i & 258048) >> 12) + u.charAt((i & 4032) >> 6) + (e === !1 ? "" : "=");
|
|
786
625
|
} else if (this.length % 3 == 1) {
|
|
787
|
-
const
|
|
788
|
-
r += u.charAt((
|
|
626
|
+
const i = this[this.length - 1] << 16;
|
|
627
|
+
r += u.charAt((i & 16515072) >> 18) + u.charAt((i & 258048) >> 12) + (e === !1 ? "" : "==");
|
|
789
628
|
}
|
|
790
629
|
return r;
|
|
791
630
|
},
|
|
792
|
-
|
|
793
|
-
configurable: !0,
|
|
794
|
-
writable: !0
|
|
631
|
+
...n
|
|
795
632
|
},
|
|
796
633
|
toUint8Array: {
|
|
797
634
|
value: function() {
|
|
798
635
|
return new Uint8Array(this);
|
|
799
636
|
},
|
|
800
|
-
|
|
801
|
-
configurable: !0,
|
|
802
|
-
writable: !0
|
|
637
|
+
...n
|
|
803
638
|
},
|
|
804
639
|
// ====== Relational ======
|
|
805
640
|
assoc: {
|
|
806
|
-
value: function(
|
|
807
|
-
const u = this.unique0((
|
|
808
|
-
return this.each0((
|
|
641
|
+
value: function(t, e, r = {}) {
|
|
642
|
+
const u = this.unique0((s) => s[t]), i = u.length == 0 ? {} : typeof r == "function" ? r(u) : r;
|
|
643
|
+
return this.each0((s) => s[e] = i[s[t]] ?? null);
|
|
809
644
|
},
|
|
810
|
-
|
|
811
|
-
configurable: !0,
|
|
812
|
-
writable: !0
|
|
645
|
+
...n
|
|
813
646
|
},
|
|
814
647
|
// ====== Tree ======
|
|
815
648
|
toTree: {
|
|
816
|
-
value: function(
|
|
817
|
-
const { id:
|
|
818
|
-
|
|
819
|
-
for (const
|
|
820
|
-
|
|
821
|
-
[
|
|
822
|
-
[
|
|
823
|
-
}),
|
|
824
|
-
return
|
|
825
|
-
},
|
|
826
|
-
|
|
827
|
-
configurable: !0,
|
|
828
|
-
writable: !0
|
|
649
|
+
value: function(t = {}) {
|
|
650
|
+
const { id: e = "id", pid: r = "pid", level: u = "level", root: i = "root", parent: s = "parent", children: o = "children", empty: f = null, hasRoot: a = !0 } = t, v = this.toObject((h) => [h[e], h]), c = this.toGroup((h) => [h[r], h]), g = this.length && a ? this.find((h) => h[r] === 0) : { [e]: 0, [r]: -1, [i]: null, [s]: null, [o]: c[0] };
|
|
651
|
+
l(g, { [i]: { value: g, enumerable: !1, configurable: !0, writable: !0 } });
|
|
652
|
+
for (const h of this)
|
|
653
|
+
l(h, {
|
|
654
|
+
[i]: { value: g, enumerable: !1, configurable: !0, writable: !0 },
|
|
655
|
+
[s]: { value: v[h[r]], enumerable: !1, configurable: !0, writable: !0 }
|
|
656
|
+
}), h[o] = c[h[e]] || f;
|
|
657
|
+
return g.treeEach0((h) => h[u] = h[s] ? h[s][u] + 1 : 0, -1, o), g;
|
|
658
|
+
},
|
|
659
|
+
...n
|
|
829
660
|
},
|
|
830
661
|
tree2tree: {
|
|
831
|
-
value: function(
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
[a]: { value: t, enumerable: !1, configurable: !0, writable: !0 },
|
|
662
|
+
value: function(t = {}, e = null, r = null) {
|
|
663
|
+
const { id: u = "id", pid: i = "pid", level: s = "level", root: o = "root", parent: f = "parent", children: a = "children", empty: v = null } = t;
|
|
664
|
+
e = e || { [u]: 0, [i]: -1, [s]: 0, [o]: null, [f]: null, [a]: this }, r = r || e;
|
|
665
|
+
for (const c of this)
|
|
666
|
+
l(c, {
|
|
667
|
+
[o]: { value: e, enumerable: !1, configurable: !0, writable: !0 },
|
|
838
668
|
[f]: { value: r, enumerable: !1, configurable: !0, writable: !0 }
|
|
839
|
-
}),
|
|
840
|
-
return
|
|
669
|
+
}), c[i] = r[u], c[s] = r[s] + 1, c[a] = c[a] && c[a].length ? c[a] : v, c[a]?.tree2tree(t, e, c);
|
|
670
|
+
return e;
|
|
841
671
|
},
|
|
842
|
-
|
|
843
|
-
configurable: !0,
|
|
844
|
-
writable: !0
|
|
672
|
+
...n
|
|
845
673
|
},
|
|
846
674
|
treeFind0: {
|
|
847
|
-
value: function(
|
|
848
|
-
for (const
|
|
849
|
-
const
|
|
850
|
-
if (
|
|
851
|
-
return
|
|
675
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
676
|
+
for (const i of this) {
|
|
677
|
+
const s = i.treeFind0(t, e, r, u);
|
|
678
|
+
if (s !== null)
|
|
679
|
+
return s;
|
|
852
680
|
}
|
|
853
681
|
return null;
|
|
854
682
|
},
|
|
855
|
-
|
|
856
|
-
configurable: !0,
|
|
857
|
-
writable: !0
|
|
683
|
+
...n
|
|
858
684
|
},
|
|
859
685
|
treeEach0: {
|
|
860
|
-
value: function(
|
|
861
|
-
for (const
|
|
862
|
-
|
|
686
|
+
value: function(t, e = !0, r = -1, u = "children") {
|
|
687
|
+
for (const i of this)
|
|
688
|
+
i.treeEach0(t, e, r, u);
|
|
863
689
|
return this;
|
|
864
690
|
},
|
|
865
|
-
|
|
866
|
-
configurable: !0,
|
|
867
|
-
writable: !0
|
|
691
|
+
...n
|
|
868
692
|
},
|
|
869
693
|
treeMap0: {
|
|
870
|
-
value: function(
|
|
871
|
-
return this.map((
|
|
694
|
+
value: function(t, e = !0, r = -1, u = "children", i = null) {
|
|
695
|
+
return this.map((s) => s.treeMap0(t, e, r, u, i));
|
|
872
696
|
},
|
|
873
|
-
|
|
874
|
-
configurable: !0,
|
|
875
|
-
writable: !0
|
|
697
|
+
...n
|
|
876
698
|
}
|
|
877
699
|
});
|
|
878
|
-
|
|
700
|
+
l(ArrayBuffer.prototype, {
|
|
879
701
|
toUint8Array: {
|
|
880
702
|
value: function() {
|
|
881
703
|
return new Uint8Array(this);
|
|
882
704
|
},
|
|
883
|
-
|
|
884
|
-
configurable: !0,
|
|
885
|
-
writable: !0
|
|
705
|
+
...n
|
|
886
706
|
}
|
|
887
707
|
});
|
|
888
|
-
|
|
708
|
+
l(Uint8Array.prototype, {
|
|
889
709
|
bytes2hex: {
|
|
890
710
|
value: Array.prototype.bytes2hex,
|
|
891
|
-
|
|
892
|
-
configurable: !0,
|
|
893
|
-
writable: !0
|
|
711
|
+
...n
|
|
894
712
|
},
|
|
895
713
|
bytes2string: {
|
|
896
714
|
value: Array.prototype.bytes2string,
|
|
897
|
-
|
|
898
|
-
configurable: !0,
|
|
899
|
-
writable: !0
|
|
715
|
+
...n
|
|
900
716
|
},
|
|
901
717
|
base64encode: {
|
|
902
718
|
value: Array.prototype.base64encode,
|
|
903
|
-
|
|
904
|
-
configurable: !0,
|
|
905
|
-
writable: !0
|
|
719
|
+
...n
|
|
906
720
|
},
|
|
907
721
|
toArray: {
|
|
908
722
|
value: function() {
|
|
909
723
|
return new Array(...this);
|
|
910
724
|
},
|
|
911
|
-
|
|
912
|
-
configurable: !0,
|
|
913
|
-
writable: !0
|
|
725
|
+
...n
|
|
914
726
|
}
|
|
915
727
|
});
|
|
916
|
-
|
|
728
|
+
l(Map.prototype, {
|
|
917
729
|
length0: {
|
|
918
730
|
value: function() {
|
|
919
731
|
return this.size;
|
|
920
732
|
},
|
|
921
|
-
|
|
922
|
-
configurable: !0,
|
|
923
|
-
writable: !0
|
|
733
|
+
...n
|
|
924
734
|
},
|
|
925
735
|
entries0: {
|
|
926
736
|
value: function() {
|
|
927
737
|
return [...this.entries()];
|
|
928
738
|
},
|
|
929
|
-
|
|
930
|
-
configurable: !0,
|
|
931
|
-
writable: !0
|
|
739
|
+
...n
|
|
932
740
|
},
|
|
933
741
|
keys0: {
|
|
934
742
|
value: function() {
|
|
935
743
|
return [...this.keys()];
|
|
936
744
|
},
|
|
937
|
-
|
|
938
|
-
configurable: !0,
|
|
939
|
-
writable: !0
|
|
745
|
+
...n
|
|
940
746
|
},
|
|
941
747
|
values0: {
|
|
942
748
|
value: function() {
|
|
943
749
|
return [...this.values()];
|
|
944
750
|
},
|
|
945
|
-
|
|
946
|
-
configurable: !0,
|
|
947
|
-
writable: !0
|
|
751
|
+
...n
|
|
948
752
|
},
|
|
949
753
|
get0: {
|
|
950
|
-
value: function(
|
|
951
|
-
if (this.has(
|
|
952
|
-
return this.get(
|
|
953
|
-
const u = typeof
|
|
954
|
-
return this.set(
|
|
754
|
+
value: function(t, e = null, ...r) {
|
|
755
|
+
if (this.has(t))
|
|
756
|
+
return this.get(t);
|
|
757
|
+
const u = typeof e != "function" ? e : e(t, ...r);
|
|
758
|
+
return this.set(t, u), u;
|
|
955
759
|
},
|
|
956
|
-
|
|
957
|
-
configurable: !0,
|
|
958
|
-
writable: !0
|
|
760
|
+
...n
|
|
959
761
|
},
|
|
960
762
|
get1: {
|
|
961
|
-
value: async function(
|
|
962
|
-
if (this.has(
|
|
963
|
-
return this.get(
|
|
964
|
-
const u = typeof
|
|
965
|
-
return this.set(
|
|
763
|
+
value: async function(t, e = null, ...r) {
|
|
764
|
+
if (this.has(t))
|
|
765
|
+
return this.get(t);
|
|
766
|
+
const u = typeof e != "function" ? e : await e(t, ...r);
|
|
767
|
+
return this.set(t, u), u;
|
|
966
768
|
},
|
|
967
|
-
|
|
968
|
-
configurable: !0,
|
|
969
|
-
writable: !0
|
|
769
|
+
...n
|
|
970
770
|
},
|
|
971
771
|
toObject: {
|
|
972
772
|
value: function() {
|
|
973
773
|
return Object.fromEntries(this);
|
|
974
774
|
},
|
|
975
|
-
|
|
976
|
-
configurable: !0,
|
|
977
|
-
writable: !0
|
|
775
|
+
...n
|
|
978
776
|
},
|
|
979
777
|
toJSON: {
|
|
980
778
|
value: function() {
|
|
981
779
|
return [...this];
|
|
982
780
|
},
|
|
983
|
-
|
|
984
|
-
configurable: !0,
|
|
985
|
-
writable: !0
|
|
781
|
+
...n
|
|
986
782
|
}
|
|
987
783
|
});
|
|
988
|
-
|
|
784
|
+
l(Set.prototype, {
|
|
989
785
|
length0: {
|
|
990
786
|
value: function() {
|
|
991
787
|
return this.size;
|
|
992
788
|
},
|
|
993
|
-
|
|
994
|
-
configurable: !0,
|
|
995
|
-
writable: !0
|
|
789
|
+
...n
|
|
996
790
|
},
|
|
997
791
|
entries0: {
|
|
998
792
|
value: function() {
|
|
999
793
|
return this.entries();
|
|
1000
794
|
},
|
|
1001
|
-
|
|
1002
|
-
configurable: !0,
|
|
1003
|
-
writable: !0
|
|
795
|
+
...n
|
|
1004
796
|
},
|
|
1005
797
|
toArray: {
|
|
1006
798
|
value: function() {
|
|
1007
799
|
return [...this];
|
|
1008
800
|
},
|
|
1009
|
-
|
|
1010
|
-
configurable: !0,
|
|
1011
|
-
writable: !0
|
|
801
|
+
...n
|
|
1012
802
|
},
|
|
1013
803
|
toJSON: {
|
|
1014
804
|
value: function() {
|
|
1015
805
|
return [...this];
|
|
1016
806
|
},
|
|
1017
|
-
|
|
1018
|
-
configurable: !0,
|
|
1019
|
-
writable: !0
|
|
807
|
+
...n
|
|
1020
808
|
}
|
|
1021
809
|
});
|
|
1022
|
-
|
|
810
|
+
l(Date, {
|
|
1023
811
|
new: {
|
|
1024
|
-
value: function(...
|
|
1025
|
-
return
|
|
812
|
+
value: function(...t) {
|
|
813
|
+
return t.length != 1 ? new Date(...t) : Number.isNaN(+t[0]) ? new Date(t[0].includes("T") ? t[0] : t[0].replace(/-/g, "/")) : new Date(t[0] > 25e8 ? t[0] : t[0] * 1e3);
|
|
1026
814
|
},
|
|
1027
|
-
|
|
1028
|
-
configurable: !0,
|
|
1029
|
-
writable: !0
|
|
815
|
+
...n
|
|
1030
816
|
},
|
|
1031
817
|
format: {
|
|
1032
|
-
value: function(
|
|
1033
|
-
return (/* @__PURE__ */ new Date()).format(
|
|
818
|
+
value: function(t = "y-m-d h:i:s") {
|
|
819
|
+
return (/* @__PURE__ */ new Date()).format(t);
|
|
1034
820
|
},
|
|
1035
|
-
|
|
1036
|
-
configurable: !0,
|
|
1037
|
-
writable: !0
|
|
821
|
+
...n
|
|
1038
822
|
},
|
|
1039
823
|
unix: {
|
|
1040
824
|
value: function() {
|
|
1041
825
|
return this.now() / 1e3 | 0;
|
|
1042
826
|
},
|
|
1043
|
-
|
|
1044
|
-
configurable: !0,
|
|
1045
|
-
writable: !0
|
|
827
|
+
...n
|
|
1046
828
|
},
|
|
1047
829
|
fromUnix: {
|
|
1048
|
-
value: function(
|
|
1049
|
-
return this.new((
|
|
830
|
+
value: function(t = 0) {
|
|
831
|
+
return this.new((t || 0) * 1e3);
|
|
1050
832
|
},
|
|
1051
|
-
|
|
1052
|
-
configurable: !0,
|
|
1053
|
-
writable: !0
|
|
833
|
+
...n
|
|
1054
834
|
},
|
|
1055
835
|
expr: {
|
|
1056
|
-
value: function(
|
|
1057
|
-
return (/* @__PURE__ */ new Date()).expr(
|
|
836
|
+
value: function(t = {}) {
|
|
837
|
+
return (/* @__PURE__ */ new Date()).expr(t);
|
|
1058
838
|
},
|
|
1059
|
-
|
|
1060
|
-
configurable: !0,
|
|
1061
|
-
writable: !0
|
|
839
|
+
...n
|
|
1062
840
|
},
|
|
1063
841
|
toDayRange: {
|
|
1064
842
|
value: function() {
|
|
1065
|
-
const
|
|
1066
|
-
return [
|
|
843
|
+
const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), r = t.getMonth(), u = t.getDate(), i = new Date(e, r, u).getTime() / 1e3 | 0;
|
|
844
|
+
return [i, i + 86400 - 1];
|
|
1067
845
|
},
|
|
1068
|
-
|
|
1069
|
-
configurable: !0,
|
|
1070
|
-
writable: !0
|
|
846
|
+
...n
|
|
1071
847
|
},
|
|
1072
848
|
toWeekRange: {
|
|
1073
849
|
value: function() {
|
|
1074
|
-
let
|
|
1075
|
-
for (;
|
|
1076
|
-
|
|
1077
|
-
const
|
|
1078
|
-
return [
|
|
850
|
+
let t = /* @__PURE__ */ new Date();
|
|
851
|
+
for (; t.getDay() != 1; )
|
|
852
|
+
t = new Date(t.getTime() - 86400);
|
|
853
|
+
const e = t.getFullYear(), r = t.getMonth(), u = t.getDate(), i = new Date(e, r, u).getTime() / 1e3 | 0;
|
|
854
|
+
return [i, i + 86400 * 7 - 1];
|
|
1079
855
|
},
|
|
1080
|
-
|
|
1081
|
-
configurable: !0,
|
|
1082
|
-
writable: !0
|
|
856
|
+
...n
|
|
1083
857
|
},
|
|
1084
858
|
toMonthRange: {
|
|
1085
859
|
value: function() {
|
|
1086
|
-
const
|
|
1087
|
-
return [u,
|
|
860
|
+
const t = /* @__PURE__ */ new Date(), e = t.getFullYear(), r = t.getMonth(), u = new Date(e, r, 1).getTime() / 1e3 | 0, i = new Date(e, r + 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
861
|
+
return [u, i];
|
|
1088
862
|
},
|
|
1089
|
-
|
|
1090
|
-
configurable: !0,
|
|
1091
|
-
writable: !0
|
|
863
|
+
...n
|
|
1092
864
|
},
|
|
1093
865
|
toYearRange: {
|
|
1094
866
|
value: function() {
|
|
1095
|
-
const
|
|
867
|
+
const e = (/* @__PURE__ */ new Date()).getFullYear(), r = new Date(e, 1, 1).getTime() / 1e3 | 0, u = new Date(e + 1, 1, 0, 23, 59, 59).getTime() / 1e3 | 0;
|
|
1096
868
|
return [r, u];
|
|
1097
869
|
},
|
|
1098
|
-
|
|
1099
|
-
configurable: !0,
|
|
1100
|
-
writable: !0
|
|
870
|
+
...n
|
|
1101
871
|
}
|
|
1102
872
|
});
|
|
1103
|
-
|
|
873
|
+
l(Date.prototype, {
|
|
1104
874
|
format: {
|
|
1105
|
-
value: function(
|
|
875
|
+
value: function(t = "y-m-d h:i:s") {
|
|
1106
876
|
if (this.getTime() === 0)
|
|
1107
877
|
return "-";
|
|
1108
|
-
const
|
|
878
|
+
const e = {
|
|
1109
879
|
y: this.getFullYear(),
|
|
1110
880
|
m: this.getMonth() + 1,
|
|
1111
881
|
d: this.getDate(),
|
|
@@ -1115,140 +885,112 @@ Object.defineProperties(Date.prototype, {
|
|
|
1115
885
|
l: this.getMilliseconds(),
|
|
1116
886
|
e: this.getMonthDay()
|
|
1117
887
|
};
|
|
1118
|
-
return
|
|
888
|
+
return t.replace(/([ymdhisle])/ig, (r, u) => u >= "A" && u <= "Z" ? e[u.toLowerCase()] : e[u].toString().padStart(u === "l" ? 3 : 2, "0"));
|
|
1119
889
|
},
|
|
1120
|
-
|
|
1121
|
-
configurable: !0,
|
|
1122
|
-
writable: !0
|
|
890
|
+
...n
|
|
1123
891
|
},
|
|
1124
892
|
unix: {
|
|
1125
893
|
value: function() {
|
|
1126
894
|
return this.getTime() / 1e3 | 0;
|
|
1127
895
|
},
|
|
1128
|
-
|
|
1129
|
-
configurable: !0,
|
|
1130
|
-
writable: !0
|
|
896
|
+
...n
|
|
1131
897
|
},
|
|
1132
898
|
isLeapYear: {
|
|
1133
899
|
value: function() {
|
|
1134
900
|
return this.getFullYear() % 4 === 0 && this.getFullYear() % 400 !== 0;
|
|
1135
901
|
},
|
|
1136
|
-
|
|
1137
|
-
configurable: !0,
|
|
1138
|
-
writable: !0
|
|
902
|
+
...n
|
|
1139
903
|
},
|
|
1140
904
|
getMonthDay: {
|
|
1141
905
|
value: function() {
|
|
1142
906
|
return [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][this.getMonth()] || (this.isLeapYear() ? 29 : 28);
|
|
1143
907
|
},
|
|
1144
|
-
|
|
1145
|
-
configurable: !0,
|
|
1146
|
-
writable: !0
|
|
908
|
+
...n
|
|
1147
909
|
},
|
|
1148
910
|
expr: {
|
|
1149
|
-
value: function({ y:
|
|
1150
|
-
const
|
|
1151
|
-
return new Date(this.getFullYear() +
|
|
911
|
+
value: function({ y: t = 0, m: e = 0, d: r = 0, h: u = 0, i = 0, s = 0 }) {
|
|
912
|
+
const o = new Date(this.getFullYear() + t, this.getMonth() + e + 1, 0);
|
|
913
|
+
return new Date(this.getFullYear() + t, this.getMonth() + e, Math.min(o.getDate(), this.getDate()) + r, this.getHours() + u, this.getMinutes() + i, this.getSeconds() + s);
|
|
1152
914
|
},
|
|
1153
|
-
|
|
1154
|
-
configurable: !0,
|
|
1155
|
-
writable: !0
|
|
915
|
+
...n
|
|
1156
916
|
},
|
|
1157
917
|
begin: {
|
|
1158
|
-
value: function(
|
|
1159
|
-
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0,
|
|
918
|
+
value: function(t = 3) {
|
|
919
|
+
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 0, 1, 0, 0, 0].slice(t));
|
|
1160
920
|
},
|
|
1161
|
-
|
|
1162
|
-
configurable: !0,
|
|
1163
|
-
writable: !0
|
|
921
|
+
...n
|
|
1164
922
|
},
|
|
1165
923
|
end: {
|
|
1166
|
-
value: function(
|
|
1167
|
-
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0,
|
|
924
|
+
value: function(t = 3) {
|
|
925
|
+
return new Date(...[this.getFullYear(), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds()].slice(0, t), ...[this.getFullYear(), 11, t < 2 ? 31 : this.getMonthDay(), 23, 59, 59].slice(t));
|
|
1168
926
|
},
|
|
1169
|
-
|
|
1170
|
-
configurable: !0,
|
|
1171
|
-
writable: !0
|
|
927
|
+
...n
|
|
1172
928
|
},
|
|
1173
929
|
week: {
|
|
1174
|
-
value: function(
|
|
930
|
+
value: function(t, e = 1) {
|
|
1175
931
|
let r = new Date(this.getTime());
|
|
1176
|
-
for (; r.getDay() !==
|
|
1177
|
-
r = new Date(r.getTime() + 864e5 *
|
|
932
|
+
for (; r.getDay() !== t; )
|
|
933
|
+
r = new Date(r.getTime() + 864e5 * e);
|
|
1178
934
|
return r;
|
|
1179
935
|
},
|
|
1180
|
-
|
|
1181
|
-
configurable: !0,
|
|
1182
|
-
writable: !0
|
|
936
|
+
...n
|
|
1183
937
|
},
|
|
1184
938
|
toJSON: {
|
|
1185
939
|
value: function() {
|
|
1186
940
|
return this.getTime();
|
|
1187
941
|
},
|
|
1188
|
-
|
|
1189
|
-
configurable: !0,
|
|
1190
|
-
writable: !0
|
|
942
|
+
...n
|
|
1191
943
|
}
|
|
1192
944
|
});
|
|
1193
|
-
|
|
945
|
+
l(RegExp.prototype, {
|
|
1194
946
|
toJSON: {
|
|
1195
947
|
value: function() {
|
|
1196
948
|
return this.toString();
|
|
1197
949
|
},
|
|
1198
|
-
|
|
1199
|
-
configurable: !0,
|
|
1200
|
-
writable: !0
|
|
950
|
+
...n
|
|
1201
951
|
}
|
|
1202
952
|
});
|
|
1203
|
-
|
|
953
|
+
l(Promise.prototype, {
|
|
1204
954
|
tryCatch: {
|
|
1205
955
|
value: function() {
|
|
1206
|
-
return new Promise((
|
|
956
|
+
return new Promise((t) => this.then((e) => t([e, null])).catch((e) => t([null, e])));
|
|
1207
957
|
},
|
|
1208
|
-
|
|
1209
|
-
configurable: !0,
|
|
1210
|
-
writable: !0
|
|
958
|
+
...n
|
|
1211
959
|
}
|
|
1212
960
|
});
|
|
1213
|
-
typeof Promise.withResolvers > "u" &&
|
|
961
|
+
typeof Promise.withResolvers > "u" && l(Promise, {
|
|
1214
962
|
withResolvers: {
|
|
1215
963
|
value: function() {
|
|
1216
|
-
let
|
|
1217
|
-
return { promise: new this((u,
|
|
1218
|
-
|
|
1219
|
-
}), resolve:
|
|
1220
|
-
},
|
|
1221
|
-
|
|
1222
|
-
configurable: !0,
|
|
1223
|
-
writable: !0
|
|
964
|
+
let t = null, e = null;
|
|
965
|
+
return { promise: new this((u, i) => {
|
|
966
|
+
t = u, e = i;
|
|
967
|
+
}), resolve: t, reject: e };
|
|
968
|
+
},
|
|
969
|
+
...n
|
|
1224
970
|
}
|
|
1225
971
|
});
|
|
1226
|
-
|
|
972
|
+
l(Promise, {
|
|
1227
973
|
channel: {
|
|
1228
974
|
value: function() {
|
|
1229
|
-
let
|
|
1230
|
-
return [new this((u,
|
|
1231
|
-
|
|
1232
|
-
}),
|
|
1233
|
-
},
|
|
1234
|
-
|
|
1235
|
-
configurable: !0,
|
|
1236
|
-
writable: !0
|
|
975
|
+
let t = null, e = null;
|
|
976
|
+
return [new this((u, i) => {
|
|
977
|
+
t = u, e = i;
|
|
978
|
+
}), t, e];
|
|
979
|
+
},
|
|
980
|
+
...n
|
|
1237
981
|
}
|
|
1238
982
|
});
|
|
1239
|
-
|
|
983
|
+
l(JSON, {
|
|
1240
984
|
parse0: {
|
|
1241
|
-
value: function(
|
|
985
|
+
value: function(t, e = null) {
|
|
1242
986
|
try {
|
|
1243
|
-
if (typeof
|
|
987
|
+
if (typeof t != "string")
|
|
1244
988
|
throw new Error("not string");
|
|
1245
|
-
return JSON.parse(
|
|
989
|
+
return JSON.parse(t);
|
|
1246
990
|
} catch {
|
|
1247
|
-
return
|
|
991
|
+
return e;
|
|
1248
992
|
}
|
|
1249
993
|
},
|
|
1250
|
-
|
|
1251
|
-
configurable: !0,
|
|
1252
|
-
writable: !0
|
|
994
|
+
...n
|
|
1253
995
|
}
|
|
1254
996
|
});
|