@byloth/core 1.3.0-rc.1 → 1.3.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/core.js CHANGED
@@ -11,8 +11,8 @@ class h extends Error {
11
11
  }
12
12
  return new h(`${e}`);
13
13
  }
14
- constructor(e, t, r = "Exception") {
15
- super(e), this.cause = t, this.name = r, t && (t instanceof Error ? this.stack += `
14
+ constructor(e, t, n = "Exception") {
15
+ super(e), this.cause = t, this.name = n, t && (t instanceof Error ? this.stack += `
16
16
 
17
17
  Caused by ${t.stack}` : this.stack += `
18
18
 
@@ -29,10 +29,10 @@ class c {
29
29
  every(e) {
30
30
  let t = 0;
31
31
  for (; ; ) {
32
- const r = this._iterator.next();
33
- if (r.done)
32
+ const n = this._iterator.next();
33
+ if (n.done)
34
34
  return !0;
35
- if (!e(r.value, t))
35
+ if (!e(n.value, t))
36
36
  return !1;
37
37
  t += 1;
38
38
  }
@@ -40,10 +40,10 @@ class c {
40
40
  some(e) {
41
41
  let t = 0;
42
42
  for (; ; ) {
43
- const r = this._iterator.next();
44
- if (r.done)
43
+ const n = this._iterator.next();
44
+ if (n.done)
45
45
  return !1;
46
- if (e(r.value, t))
46
+ if (e(n.value, t))
47
47
  return !0;
48
48
  t += 1;
49
49
  }
@@ -51,40 +51,40 @@ class c {
51
51
  filter(e) {
52
52
  const t = this._iterator;
53
53
  return new c(function* () {
54
- let r = 0;
54
+ let n = 0;
55
55
  for (; ; ) {
56
- const n = t.next();
57
- if (n.done)
58
- return n.value;
59
- e(n.value, r) && (yield n.value), r += 1;
56
+ const r = t.next();
57
+ if (r.done)
58
+ return r.value;
59
+ e(r.value, n) && (yield r.value), n += 1;
60
60
  }
61
61
  });
62
62
  }
63
63
  map(e) {
64
64
  const t = this._iterator;
65
65
  return new c(function* () {
66
- let r = 0;
66
+ let n = 0;
67
67
  for (; ; ) {
68
- const n = t.next();
69
- if (n.done)
70
- return n.value;
71
- yield e(n.value, r), r += 1;
68
+ const r = t.next();
69
+ if (r.done)
70
+ return r.value;
71
+ yield e(r.value, n), n += 1;
72
72
  }
73
73
  });
74
74
  }
75
75
  reduce(e, t) {
76
- let r = 0, n = t;
77
- if (n === void 0) {
76
+ let n = 0, r = t;
77
+ if (r === void 0) {
78
78
  const o = this._iterator.next();
79
79
  if (o.done)
80
80
  throw new TypeError("Reduce of empty iterator with no initial value");
81
- n = o.value, r += 1;
81
+ r = o.value, n += 1;
82
82
  }
83
83
  for (; ; ) {
84
84
  const o = this._iterator.next();
85
85
  if (o.done)
86
- return n;
87
- n = e(n, o.value, r), r += 1;
86
+ return r;
87
+ r = e(r, o.value, n), n += 1;
88
88
  }
89
89
  }
90
90
  enumerate() {
@@ -95,10 +95,10 @@ class c {
95
95
  return new c(function* () {
96
96
  const t = /* @__PURE__ */ new Set();
97
97
  for (; ; ) {
98
- const r = e.next();
99
- if (r.done)
100
- return r.value;
101
- t.has(r.value) || (t.add(r.value), yield r.value);
98
+ const n = e.next();
99
+ if (n.done)
100
+ return n.value;
101
+ t.has(n.value) || (t.add(n.value), yield n.value);
102
102
  }
103
103
  });
104
104
  }
@@ -113,10 +113,10 @@ class c {
113
113
  forEach(e) {
114
114
  let t = 0;
115
115
  for (; ; ) {
116
- const r = this._iterator.next();
117
- if (r.done)
116
+ const n = this._iterator.next();
117
+ if (n.done)
118
118
  return;
119
- e(r.value, t), t += 1;
119
+ e(n.value, t), t += 1;
120
120
  }
121
121
  }
122
122
  next(...e) {
@@ -137,15 +137,15 @@ class l {
137
137
  filter(e) {
138
138
  const t = this._elements;
139
139
  return new l(function* () {
140
- for (const [r, [n, o]] of t.enumerate())
141
- e(n, o, r) && (yield [n, o]);
140
+ for (const [n, [r, o]] of t.enumerate())
141
+ e(r, o, n) && (yield [r, o]);
142
142
  });
143
143
  }
144
144
  map(e) {
145
145
  const t = this._elements;
146
146
  return new l(function* () {
147
- for (const [r, [n, o]] of t.enumerate())
148
- yield [n, e(n, o, r)];
147
+ for (const [n, [r, o]] of t.enumerate())
148
+ yield [r, e(r, o, n)];
149
149
  });
150
150
  }
151
151
  toArray() {
@@ -165,84 +165,84 @@ class f {
165
165
  }
166
166
  every(e) {
167
167
  const t = /* @__PURE__ */ new Map();
168
- for (const [r, n] of this._elements) {
169
- const [o, i] = t.get(r) ?? [0, !0];
170
- i && t.set(r, [o + 1, e(r, n, o)]);
168
+ for (const [n, r] of this._elements) {
169
+ const [o, i] = t.get(n) ?? [0, !0];
170
+ i && t.set(n, [o + 1, e(n, r, o)]);
171
171
  }
172
172
  return new l(function* () {
173
- for (const [r, [n, o]] of t)
174
- yield [r, o];
173
+ for (const [n, [r, o]] of t)
174
+ yield [n, o];
175
175
  });
176
176
  }
177
177
  some(e) {
178
178
  const t = /* @__PURE__ */ new Map();
179
- for (const [r, n] of this._elements) {
180
- const [o, i] = t.get(r) ?? [0, !1];
181
- i || t.set(r, [o + 1, e(r, n, o)]);
179
+ for (const [n, r] of this._elements) {
180
+ const [o, i] = t.get(n) ?? [0, !1];
181
+ i || t.set(n, [o + 1, e(n, r, o)]);
182
182
  }
183
183
  return new l(function* () {
184
- for (const [r, [n, o]] of t)
185
- yield [r, o];
184
+ for (const [n, [r, o]] of t)
185
+ yield [n, o];
186
186
  });
187
187
  }
188
188
  filter(e) {
189
189
  const t = this._elements;
190
190
  return new f(function* () {
191
- const r = /* @__PURE__ */ new Map();
192
- for (const [n, o] of t) {
193
- const i = r.get(n) ?? 0;
194
- r.set(n, i + 1), e(n, o, i) && (yield [n, o]);
191
+ const n = /* @__PURE__ */ new Map();
192
+ for (const [r, o] of t) {
193
+ const i = n.get(r) ?? 0;
194
+ n.set(r, i + 1), e(r, o, i) && (yield [r, o]);
195
195
  }
196
196
  });
197
197
  }
198
198
  map(e) {
199
199
  const t = this._elements;
200
200
  return new f(function* () {
201
- const r = /* @__PURE__ */ new Map();
202
- for (const [n, o] of t) {
203
- const i = r.get(n) ?? 0;
204
- r.set(n, i + 1), yield [n, e(n, o, i)];
201
+ const n = /* @__PURE__ */ new Map();
202
+ for (const [r, o] of t) {
203
+ const i = n.get(r) ?? 0;
204
+ n.set(r, i + 1), yield [r, e(r, o, i)];
205
205
  }
206
206
  });
207
207
  }
208
208
  reduce(e, t) {
209
- const r = /* @__PURE__ */ new Map();
210
- for (const [n, o] of this._elements) {
209
+ const n = /* @__PURE__ */ new Map();
210
+ for (const [r, o] of this._elements) {
211
211
  let i, a;
212
- if (r.has(n))
213
- [i, a] = r.get(n), i += 1;
212
+ if (n.has(r))
213
+ [i, a] = n.get(r), i += 1;
214
214
  else if (t !== void 0)
215
215
  i = 0, a = t;
216
216
  else {
217
- r.set(n, [0, o]);
217
+ n.set(r, [0, o]);
218
218
  continue;
219
219
  }
220
- a = e(n, a, o, i), r.set(n, [i, a]);
220
+ a = e(r, a, o, i), n.set(r, [i, a]);
221
221
  }
222
222
  return new l(function* () {
223
- for (const [n, [o, i]] of r)
224
- yield [n, i];
223
+ for (const [r, [o, i]] of n)
224
+ yield [r, i];
225
225
  });
226
226
  }
227
227
  unique() {
228
228
  const e = this._elements;
229
229
  return new f(function* () {
230
230
  const t = /* @__PURE__ */ new Map();
231
- for (const [r, n] of e) {
232
- const o = t.get(r) ?? /* @__PURE__ */ new Set();
233
- o.has(n) || (o.add(n), t.set(r, o), yield [r, n]);
231
+ for (const [n, r] of e) {
232
+ const o = t.get(n) ?? /* @__PURE__ */ new Set();
233
+ o.has(r) || (o.add(r), t.set(n, o), yield [n, r]);
234
234
  }
235
235
  });
236
236
  }
237
237
  count() {
238
238
  const e = /* @__PURE__ */ new Map();
239
239
  for (const [t] of this._elements) {
240
- const r = e.get(t) ?? 0;
241
- e.set(t, r + 1);
240
+ const n = e.get(t) ?? 0;
241
+ e.set(t, n + 1);
242
242
  }
243
243
  return new l(function* () {
244
- for (const [t, r] of e)
245
- yield [t, r];
244
+ for (const [t, n] of e)
245
+ yield [t, n];
246
246
  });
247
247
  }
248
248
  toArray() {
@@ -250,17 +250,17 @@ class f {
250
250
  }
251
251
  toMap() {
252
252
  const e = /* @__PURE__ */ new Map();
253
- for (const [t, r] of this._elements) {
254
- const n = e.get(t) ?? [];
255
- n.push(r), e.set(t, n);
253
+ for (const [t, n] of this._elements) {
254
+ const r = e.get(t) ?? [];
255
+ r.push(n), e.set(t, r);
256
256
  }
257
257
  return e;
258
258
  }
259
259
  toObject() {
260
260
  const e = {};
261
- for (const [t, r] of this._elements) {
262
- const n = e[t] ?? [];
263
- n.push(r), e[t] = n;
261
+ for (const [t, n] of this._elements) {
262
+ const r = e[t] ?? [];
263
+ r.push(n), e[t] = r;
264
264
  }
265
265
  return e;
266
266
  }
@@ -280,7 +280,7 @@ class m {
280
280
  return new m(this._elements.unique());
281
281
  }
282
282
  byKey(e) {
283
- return new f(this._elements.map((t, r) => [e(t, r), t]));
283
+ return new f(this._elements.map((t, n) => [e(t, n), t]));
284
284
  }
285
285
  }
286
286
  class p {
@@ -288,10 +288,10 @@ class p {
288
288
  u(this, "_resolve");
289
289
  u(this, "_reject");
290
290
  u(this, "_promise");
291
- let r, n;
291
+ let n, r;
292
292
  this._promise = new Promise((o, i) => {
293
- r = o, n = i;
294
- }).then(e, t), this._resolve = r, this._reject = n;
293
+ n = o, r = i;
294
+ }).then(e, t), this._resolve = n, this._reject = r;
295
295
  }
296
296
  get resolve() {
297
297
  return this._resolve;
@@ -322,25 +322,25 @@ class x {
322
322
  u(this, "_persistent");
323
323
  this._preferPersistence = e, this._volatile = window.sessionStorage, this._persistent = window.localStorage;
324
324
  }
325
- _get(e, t, r) {
326
- const n = e.getItem(t);
327
- if (n)
325
+ _get(e, t, n) {
326
+ const r = e.getItem(t);
327
+ if (r)
328
328
  try {
329
- return JSON.parse(n);
329
+ return JSON.parse(r);
330
330
  } catch {
331
331
  console.warn(
332
- `The "${n}" value for "${t}" property cannot be parsed. Clearing the storage...`
332
+ `The "${r}" value for "${t}" property cannot be parsed. Clearing the storage...`
333
333
  ), e.removeItem(t);
334
334
  }
335
- return r;
335
+ return n;
336
336
  }
337
- _set(e, t, r) {
338
- const n = JSON.stringify(r);
339
- n ? e.setItem(t, n) : e.removeItem(t);
337
+ _set(e, t, n) {
338
+ const r = JSON.stringify(n);
339
+ r ? e.setItem(t, r) : e.removeItem(t);
340
340
  }
341
- get(e, t, r = this._preferPersistence) {
342
- const n = r ? this._persistent : this._volatile;
343
- return this._get(n, e, t);
341
+ get(e, t, n = this._preferPersistence) {
342
+ const r = n ? this._persistent : this._volatile;
343
+ return this._get(r, e, t);
344
344
  }
345
345
  recall(e, t) {
346
346
  return this._get(this._volatile, e, t);
@@ -401,9 +401,9 @@ class x {
401
401
  * @param newValue The new value to set.
402
402
  * @param persistent Whether to use the persistent `localStorage` or the volatile `sessionStorage`.
403
403
  */
404
- set(e, t, r = this._preferPersistence) {
405
- const n = r ? this._persistent : this._volatile;
406
- this._set(n, e, t);
404
+ set(e, t, n = this._preferPersistence) {
405
+ const r = n ? this._persistent : this._volatile;
406
+ this._set(r, e, t);
407
407
  }
408
408
  /**
409
409
  * Sets the value with the specified name in the volatile `sessionStorage`.
@@ -497,19 +497,19 @@ function S(s, e, t = 864e5) {
497
497
  }
498
498
  function j(s, e, t = 864e5) {
499
499
  return new c(function* () {
500
- const r = e.getTime();
501
- let n = s.getTime();
502
- for (; n < r; )
503
- yield new Date(n), n += t;
500
+ const n = e.getTime();
501
+ let r = s.getTime();
502
+ for (; r < n; )
503
+ yield new Date(r), r += t;
504
504
  });
505
505
  }
506
506
  function I(s, e = 864e5) {
507
507
  return new Date(Math.floor(s.getTime() / e) * e);
508
508
  }
509
509
  async function A(s, e = "text/javascript") {
510
- return new Promise((t, r) => {
511
- const n = document.createElement("script");
512
- n.async = !0, n.defer = !0, n.src = s, n.type = e, n.onload = () => t(), n.onerror = () => r(), document.body.appendChild(n);
510
+ return new Promise((t, n) => {
511
+ const r = document.createElement("script");
512
+ r.async = !0, r.defer = !0, r.src = s, r.type = e, r.onload = () => t(), r.onerror = () => n(), document.body.appendChild(r);
513
513
  });
514
514
  }
515
515
  function T(s) {
@@ -523,15 +523,15 @@ function T(s) {
523
523
  function P(s, e, t = 1) {
524
524
  return new c(function* () {
525
525
  e === void 0 && (e = s, s = 0), s > e && (t = t ?? -1);
526
- for (let r = s; r < e; r += t)
527
- yield r;
526
+ for (let n = s; n < e; n += t)
527
+ yield n;
528
528
  });
529
529
  }
530
530
  function q(s) {
531
531
  const e = Array.from(s);
532
532
  for (let t = e.length - 1; t > 0; t -= 1) {
533
- const r = Math.floor(Math.random() * (t + 1));
534
- [e[t], e[r]] = [e[r], e[t]];
533
+ const n = Math.floor(Math.random() * (t + 1));
534
+ [e[t], e[n]] = [e[n], e[t]];
535
535
  }
536
536
  return e;
537
537
  }
@@ -544,32 +544,32 @@ function C(s) {
544
544
  }
545
545
  function y(s, e) {
546
546
  return new c(function* () {
547
- const t = s[Symbol.iterator](), r = e[Symbol.iterator]();
547
+ const t = s[Symbol.iterator](), n = e[Symbol.iterator]();
548
548
  for (; ; ) {
549
- const n = t.next(), o = r.next();
550
- if (n.done || o.done)
549
+ const r = t.next(), o = n.next();
550
+ if (r.done || o.done)
551
551
  break;
552
- yield [n.value, o.value];
552
+ yield [r.value, o.value];
553
553
  }
554
554
  });
555
555
  }
556
556
  function E(s, e) {
557
557
  if (e === void 0) {
558
- let n = 0, o = 0;
558
+ let r = 0, o = 0;
559
559
  for (const i of s)
560
- n += i, o += 1;
561
- return n / o;
560
+ r += i, o += 1;
561
+ return r / o;
562
562
  }
563
- let t = 0, r = 0;
564
- for (const [n, o] of y(s, e))
565
- t += n * o, r += o;
566
- return t / r;
563
+ let t = 0, n = 0;
564
+ for (const [r, o] of y(s, e))
565
+ t += r * o, n += o;
566
+ return t / n;
567
567
  }
568
568
  function O(s) {
569
569
  let e = 0;
570
570
  for (let t = 0; t < s.length; t += 1) {
571
- const r = s.charCodeAt(t);
572
- e = (e << 5) - e + r, e |= 0;
571
+ const n = s.charCodeAt(t);
572
+ e = (e << 5) - e + n, e |= 0;
573
573
  }
574
574
  return e;
575
575
  }
@@ -582,7 +582,7 @@ function $(s) {
582
582
  function R(s) {
583
583
  return `${s.charAt(0).toUpperCase()}${s.slice(1)}`;
584
584
  }
585
- const F = "1.3.0-rc.1";
585
+ const F = "1.3.0";
586
586
  export {
587
587
  f as AggregatedIterator,
588
588
  m as Aggregator,