@tktb-tess/util-fns 0.5.0 → 0.6.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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Tessyrrhaqt
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Tessyrrhaqt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,31 +1,30 @@
1
- # util-fns
2
-
3
- Utility functions for personal use
4
-
5
- ESM only
6
-
7
- Available in both a browser and Node.js environment.
8
-
9
- ## Install
10
-
11
- ```bash
12
- npm i @tktb-tess/util-fns
13
- ```
14
-
15
- ### Usage
16
-
17
- ```ts
18
- import { modPow } from '@tktb-tess/util-fns';
19
-
20
- const main = async () => {
21
- const ans = modPow(2n, 16n, 17n);
22
-
23
- console.log(ans); // 1n
24
- };
25
-
26
- main();
27
-
28
- ```
29
-
30
-
31
-
1
+ # util-fns
2
+
3
+ Utility functions for personal use
4
+
5
+ ESM only
6
+
7
+ Available in both a browser and Node.js environment.
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm i @tktb-tess/util-fns
13
+ ```
14
+
15
+ ### Usage
16
+
17
+ ```ts
18
+ import { modPow, bailliePSW } from '@tktb-tess/util-fns';
19
+
20
+ const ans = modPow(2n, 16n, 17n);
21
+ console.log(ans); // 1n
22
+
23
+ // Baillie-PSW primality test
24
+ console.log(bailliePSW(2n)); // true
25
+ console.log(bailliePSW(4n)): // false
26
+
27
+ ```
28
+
29
+
30
+
package/dist/brand.d.ts CHANGED
@@ -1,7 +0,0 @@
1
- declare const Brand: unique symbol;
2
- type Brand<in out K extends string | symbol> = {
3
- readonly [Brand]: {
4
- readonly [key in K]: K;
5
- };
6
- };
7
- export { Brand };
package/dist/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
1
+ const U = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
2
2
  if (typeof n != typeof t) return !1;
3
3
  const e = Object.prototype.toString.call(n), r = Object.prototype.toString.call(t);
4
4
  if (e !== r) return !1;
@@ -27,7 +27,7 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
27
27
  if (e === "[object Object]") {
28
28
  const s = n, i = t, o = Object.keys(s), c = Object.keys(i);
29
29
  for (const u of o) {
30
- const l = c.find((B) => B === u);
30
+ const l = c.find((E) => E === u);
31
31
  if (l === void 0) return !1;
32
32
  const [h, g] = [s[u], i[l]];
33
33
  if (!a(h, g)) return !1;
@@ -35,7 +35,7 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
35
35
  return !0;
36
36
  }
37
37
  throw Error(`comparing these objects is still unavailable: ${n} ${t}`);
38
- }, F = () => {
38
+ }, $ = () => {
39
39
  let n, t;
40
40
  return {
41
41
  promise: new Promise((r, s) => {
@@ -44,9 +44,9 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
44
44
  resolve: n,
45
45
  reject: t
46
46
  };
47
- }, O = (n) => new Promise((t) => {
47
+ }, q = (n) => new Promise((t) => {
48
48
  setTimeout(() => t(), n);
49
- }), L = (n) => (...t) => () => n(...t), $ = (n) => {
49
+ }), D = (n) => (...t) => () => n(...t), K = (n) => {
50
50
  const t = [];
51
51
  let e = [], r = "", s = !1;
52
52
  for (let i = 0; i < n.length; i++) {
@@ -55,31 +55,31 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
55
55
  ` && !s ? (e.push(r.trim()), t.push(e), e = [], r = "") : r += o;
56
56
  }
57
57
  return e.push(r.trim()), t.push(e), t;
58
- }, q = async (n, t) => {
59
- const e = A.encode(n), r = await crypto.subtle.digest(t, e);
58
+ }, k = async (n, t) => {
59
+ const e = U.encode(n), r = await crypto.subtle.digest(t, e);
60
60
  return new Uint8Array(r);
61
- }, D = () => globalThis.process && typeof process.version < "u" && typeof process.versions.node < "u", K = (n) => encodeURIComponent(n).replace(
61
+ }, J = () => globalThis.process && typeof process.version < "u" && typeof process.versions.node < "u", W = (n) => encodeURIComponent(n).replace(
62
62
  /[!'()*]/g,
63
63
  (e) => `%${e.charCodeAt(0).toString(16).toUpperCase()}`
64
- ), k = (n) => {
64
+ ), z = (n) => {
65
65
  if (n.includes("+"))
66
66
  throw Error("An input string has '+'");
67
67
  return decodeURIComponent(n);
68
- }, J = (n, t) => Math.floor(Math.random() * (t - n) + n), d = (n, t) => {
68
+ }, G = (n, t) => Math.floor(Math.random() * (t - n) + n), d = (n, t) => {
69
69
  t < 0n && (t *= -1n);
70
70
  const e = n % t;
71
71
  return e < 0n ? e + t : e;
72
- }, S = (n, t = !1) => {
72
+ }, b = (n, t = !1) => {
73
73
  if (!Number.isFinite(n)) throw Error("`length` is not a valid number");
74
74
  if (n <= 0) throw Error("`length` must be positive");
75
75
  const e = Math.ceil(n / 8), r = crypto.getRandomValues(new Uint8Array(e));
76
76
  let s = Array.from(r, (i) => i.toString(2).padStart(8, "0")).join("").slice(0, n);
77
77
  return t && (s = s.replace(/^./, "1")), BigInt("0b" + s);
78
- }, N = (n, t) => {
78
+ }, P = (n, t) => {
79
79
  if (n >= t) throw Error("rangeError");
80
80
  const e = t - n, r = e.toString(2).length, s = (() => {
81
81
  for (let o = 0; o < 1e5; o++) {
82
- const c = S(r);
82
+ const c = b(r);
83
83
  if (c >= p(2n, BigInt(r), e))
84
84
  return c % e;
85
85
  }
@@ -96,7 +96,7 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
96
96
  for (; t > 0n; )
97
97
  t & 1n && (r = r * n % e), n = n * n % e, t >>= 1n;
98
98
  return r;
99
- }, E = (n, t) => {
99
+ }, T = (n, t) => {
100
100
  if (n === 0n && t === 0n) return { x: 0n, y: 0n, gcd: 0n };
101
101
  if (n === 0n)
102
102
  return t > 0n ? { x: 0n, y: -1n, gcd: t } : { x: 0n, y: 1n, gcd: -t };
@@ -109,7 +109,7 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
109
109
  [e, i] = [i, e - u * i], [r, o] = [o, r - u * o], [s, c] = [c, l];
110
110
  }
111
111
  return c < 0n && (i *= -1n, o *= -1n, c *= -1n), { x: i, y: o, gcd: c };
112
- }, m = (n, t) => {
112
+ }, y = (n, t) => {
113
113
  if (n >= t) return 1n;
114
114
  const e = BigInt((t - 2n).toString(2).length), r = (t - n) / 2n;
115
115
  if (e * r < 63n) {
@@ -118,22 +118,22 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
118
118
  c *= u;
119
119
  return c;
120
120
  }
121
- const s = n + r | 1n, i = m(n, s), o = m(s, t);
121
+ const s = n + r | 1n, i = y(n, s), o = y(s, t);
122
122
  return i * o;
123
- }, P = (n) => {
123
+ }, j = (n) => {
124
124
  let t = 3n, e = 1n, r = 1n;
125
125
  const s = BigInt(n.toString(2).length) - 1n;
126
126
  for (let i = s - 1n; i > -1n; --i) {
127
127
  const o = (n >> i) + 1n | 1n;
128
- r *= m(t, o), t = o, e *= r;
128
+ r *= y(t, o), t = o, e *= r;
129
129
  }
130
130
  return e;
131
- }, G = (n) => {
131
+ }, H = (n) => {
132
132
  if (n < 0n) throw Error("'n' must be non-negative");
133
133
  if (n === 0n) return 1n;
134
134
  const t = n - BigInt(n.toString(2).match(/1/g)?.length ?? 0);
135
- return P(n) << t;
136
- }, W = (n, t) => BigInt.asUintN(32, n >> (t & 31n) | n << (-t & 31n)), U = (n, t) => (n >>> (t & 31) | n << (-t & 31)) >>> 0, w = (n, t) => {
135
+ return j(n) << t;
136
+ }, Z = (n, t) => BigInt.asUintN(32, n >> (t & 31n) | n << (-t & 31n)), v = (n, t) => (n >>> (t & 31) | n << (-t & 31)) >>> 0, w = (n, t) => {
137
137
  if (t < 1n || t % 2n === 0n)
138
138
  throw Error("`n` is invalid");
139
139
  for (; n < 0n; )
@@ -149,7 +149,7 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
149
149
  [n, t] = [t, n], n % 4n === 3n && t % 4n === 3n && (e *= -1n), n %= t;
150
150
  }
151
151
  return t === 1n ? e : 0n;
152
- }, j = (n) => {
152
+ }, x = (n) => {
153
153
  if (n < 0n) return !1;
154
154
  if (n === 0n) return !0;
155
155
  let t = 1n, e = n;
@@ -158,15 +158,18 @@ const A = new TextEncoder(), _ = (n, t) => [n].includes(t), a = (n, t) => {
158
158
  r ** 2n < n ? t = r : e = r;
159
159
  }
160
160
  return n === t ** 2n || n === (t + 1n) ** 2n;
161
- }, b = [0x853c49e6748fea9bn, 0xda3e39cb94b95bdbn], v = 0x5851f42d4c957f2dn;
162
- class z {
161
+ }, S = [0x853c49e6748fea9bn, 0xda3e39cb94b95bdbn], M = 0x5851f42d4c957f2dn;
162
+ class I {
163
163
  /**
164
164
  * length = 2, `[state, increment]`
165
165
  */
166
166
  #t = new BigUint64Array(2);
167
- get [Symbol.toStringTag]() {
167
+ static get name() {
168
168
  return "PCGMinimal";
169
169
  }
170
+ get [Symbol.toStringTag]() {
171
+ return I.name;
172
+ }
170
173
  /** シード値の配列を返す */
171
174
  static getSeed() {
172
175
  return crypto.getRandomValues(new BigUint64Array(2));
@@ -175,18 +178,18 @@ class z {
175
178
  * @param seeds 64bit整数の配列 (長さ2以上), 省略した場合, 常に同じ値によって初期化される
176
179
  */
177
180
  constructor(t) {
178
- t ? (this.#t[1] = t[1] << 1n | 1n, this.#n(), this.#t[0] = t[0], this.#n()) : (this.#t[0] = b[0], this.#t[1] = b[1]);
181
+ t ? (this.#t[1] = t[1] << 1n | 1n, this.#n(), this.#t[0] = t[0], this.#n()) : (this.#t[0] = S[0], this.#t[1] = S[1]);
179
182
  }
180
183
  /** 内部状態を1サイクル進める */
181
184
  #n() {
182
- this.#t[0] = this.#t[0] * v + this.#t[1];
185
+ this.#t[0] = this.#t[0] * M + this.#t[1];
183
186
  }
184
187
  /** 32bit 乱数を返す (内部状態は変わらない) */
185
188
  get #e() {
186
189
  const t = this.#t[0];
187
190
  if (!t) throw Error("empty state");
188
191
  const e = t >> 59n, r = BigInt.asUintN(32, (t ^ t >> 18n) >> 27n);
189
- return U(Number(r), Number(e));
192
+ return v(Number(r), Number(e));
190
193
  }
191
194
  /** 内部状態を1進め、乱数を返す \
192
195
  * 普通はこれを使う
@@ -213,7 +216,7 @@ class z {
213
216
  yield typeof e == "number" ? this.getBoundedRand(e) : this.getRand();
214
217
  }
215
218
  }
216
- const M = (n) => {
219
+ const V = (n) => {
217
220
  if (n <= 1n) return !1;
218
221
  if (n % 2n === 0n) return n === 2n;
219
222
  let t = n - 1n, e = 0n;
@@ -227,26 +230,26 @@ const M = (n) => {
227
230
  o = o * o % n;
228
231
  }
229
232
  return !1;
230
- }, T = (n) => {
233
+ }, C = (n) => {
231
234
  let t = 5n, e = w(t, n);
232
235
  for (; e > 0n; ) {
233
- if (t = t > 0n ? t + 2n : t - 2n, t *= -1n, t === -15n && j(n))
236
+ if (t = t > 0n ? t + 2n : t - 2n, t *= -1n, t === -15n && x(n))
234
237
  return [0n, 0n];
235
238
  e = w(t, n);
236
239
  }
237
240
  return [t, e];
238
- }, y = (n, t) => (n & 1n) === 1n ? d(n + t >> 1n, t) : d(n >> 1n, t), x = (n, t, e, r) => {
241
+ }, m = (n, t) => (n & 1n) === 1n ? d(n + t >> 1n, t) : d(n >> 1n, t), R = (n, t, e, r) => {
239
242
  let s = 1n, i = e;
240
243
  const o = n.toString(2).slice(1);
241
244
  for (const c of o)
242
- [s, i] = [d(s * i, t), y(i * i + r * s * s, t)], c === "1" && ([s, i] = [y(e * s + i, t), y(r * s + e * i, t)]);
245
+ [s, i] = [d(s * i, t), m(i * i + r * s * s, t)], c === "1" && ([s, i] = [m(e * s + i, t), m(r * s + e * i, t)]);
243
246
  return [s, i];
244
- }, C = (n, t, e, r) => {
247
+ }, F = (n, t, e, r) => {
245
248
  if (n % 2n !== 1n) throw Error("`n` must be odd");
246
249
  let s = n + 1n, i = 0n;
247
250
  for (; s % 2n === 0n; )
248
251
  s >>= 1n, i += 1n;
249
- const [o, c] = x(s, n, e, t);
252
+ const [o, c] = R(s, n, e, t);
250
253
  let u = c;
251
254
  if (o === 0n) return !0;
252
255
  r = p(r, s, n);
@@ -255,7 +258,7 @@ const M = (n) => {
255
258
  u = d(u * u - 2n * r, n), r = p(r, 2n, n);
256
259
  }
257
260
  return !1;
258
- }, I = (n) => {
261
+ }, A = (n) => {
259
262
  if (n <= 1n) return !1;
260
263
  if (n % 2n === 0n) return n === 2n;
261
264
  const t = [
@@ -289,35 +292,38 @@ const M = (n) => {
289
292
  for (const i of t)
290
293
  if (n % i === 0n)
291
294
  return n === i;
292
- if (!M(n))
295
+ if (!V(n))
293
296
  return !1;
294
- const [e, r] = T(n);
297
+ const [e, r] = C(n);
295
298
  if (r === 0n) return !1;
296
299
  const s = (1n - e) / 4n;
297
- return C(n, e, 1n, s);
298
- }, H = (n, t) => {
300
+ return F(n, e, 1n, s);
301
+ }, X = (n, t) => {
299
302
  if (t < 2n)
300
303
  throw Error("noPrimesFound");
301
304
  for (let r = 0; r < 1e5; r++) {
302
- const s = N(n, t);
303
- if (I(s)) return s;
305
+ const s = P(n, t);
306
+ if (A(s)) return s;
304
307
  }
305
308
  throw Error("noPrimesFound");
306
- }, Z = (n, t = !1) => {
309
+ }, Y = (n, t = !1) => {
307
310
  if (n < 2)
308
311
  throw Error("noPrimesFound");
309
312
  for (let r = 0; r < 1e5; r++) {
310
- const s = S(n, t);
311
- if (I(s)) return s;
313
+ const s = b(n, t);
314
+ if (A(s)) return s;
312
315
  }
313
316
  throw Error("noPrimesFound");
314
317
  };
315
318
  class f {
316
319
  #t;
317
320
  #n;
318
- get [Symbol.toStringTag]() {
321
+ static get name() {
319
322
  return "Rational";
320
323
  }
324
+ get [Symbol.toStringTag]() {
325
+ return f.name;
326
+ }
321
327
  /**
322
328
  *
323
329
  * @param numerator
@@ -355,7 +361,7 @@ class f {
355
361
  * reduction
356
362
  */
357
363
  #e() {
358
- const { gcd: t } = E(this.#t, this.#n);
364
+ const { gcd: t } = T(this.#t, this.#n);
359
365
  t !== 0n && (this.#t /= t, this.#n /= t);
360
366
  }
361
367
  /**
@@ -457,24 +463,27 @@ const Q = (n) => {
457
463
  t.length & 1 && (t = "0" + t);
458
464
  const e = [...t.match(/.{2}/g) ?? []];
459
465
  return Uint8Array.from(e, (r) => Number.parseInt(r, 16));
460
- }, X = (n) => {
466
+ }, tt = (n) => {
461
467
  const t = Array.from(n, (e) => e.toString(16).padStart(2, "0")).join("") || "00";
462
468
  return BigInt("0x" + t);
463
- }, V = (n) => {
469
+ }, O = (n) => {
464
470
  const t = Array.from(n, (e) => String.fromCharCode(e)).join("");
465
471
  return btoa(t);
466
- }, R = (n) => Uint8Array.from(atob(n), (t) => t.charCodeAt(0)), Y = (n) => V(n).replaceAll("+", "-").replaceAll("/", "_").replace(/=*$/g, ""), tt = (n) => {
472
+ }, L = (n) => Uint8Array.from(atob(n), (t) => t.charCodeAt(0)), nt = (n) => O(n).replaceAll("+", "-").replaceAll("/", "_").replace(/=*$/g, ""), et = (n) => {
467
473
  const t = n.length & 3;
468
474
  t > 0 && (n = n + "=".repeat(4 - t));
469
475
  const e = n.replaceAll("-", "+").replaceAll("_", "/");
470
- return R(e);
471
- }, nt = Symbol("for-branded-type");
472
- class et {
473
- get [Symbol.toStringTag]() {
474
- return "Queue";
475
- }
476
+ return L(e);
477
+ };
478
+ class B {
476
479
  #t;
477
480
  #n = [];
481
+ static get name() {
482
+ return "Queue";
483
+ }
484
+ get [Symbol.toStringTag]() {
485
+ return B.name;
486
+ }
478
487
  constructor(...t) {
479
488
  this.#t = t;
480
489
  }
@@ -499,8 +508,14 @@ class et {
499
508
  return this.toArray().toString();
500
509
  }
501
510
  }
502
- class rt {
511
+ class N {
503
512
  #t;
513
+ static get name() {
514
+ return "Executer";
515
+ }
516
+ get [Symbol.toStringTag]() {
517
+ return N.name;
518
+ }
504
519
  constructor(t) {
505
520
  this.#t = {
506
521
  state: "pending",
@@ -517,7 +532,7 @@ class rt {
517
532
  };
518
533
  });
519
534
  }
520
- peer() {
535
+ get() {
521
536
  switch (this.#t.state) {
522
537
  case "fulfilled":
523
538
  return this.#t.data;
@@ -545,38 +560,37 @@ class rt {
545
560
  }
546
561
  export {
547
562
  Q as BItoU8Arr,
548
- nt as Brand,
549
- rt as Executer,
550
- z as PCGMinimal,
551
- et as Queue,
563
+ N as Executer,
564
+ I as PCGMinimal,
565
+ B as Queue,
552
566
  f as Rational,
553
- I as bailliePSW,
554
- R as base64ToU8Arr,
555
- tt as base64UrlToU8Arr,
556
- k as decodeRFC3986URIComponent,
557
- K as encodeRFC3986URIComponent,
558
- E as exEuclidean,
559
- G as factorial,
560
- q as getHash,
561
- S as getRandBIByBitLength,
562
- N as getRandBIByRange,
563
- Z as getRandPrimeByBitLength,
564
- H as getRandPrimeByRange,
565
- J as getRndInt,
567
+ A as bailliePSW,
568
+ L as base64ToU8Arr,
569
+ et as base64UrlToU8Arr,
570
+ z as decodeRFC3986URIComponent,
571
+ W as encodeRFC3986URIComponent,
572
+ T as exEuclidean,
573
+ H as factorial,
574
+ k as getHash,
575
+ b as getRandBIByBitLength,
576
+ P as getRandBIByRange,
577
+ Y as getRandPrimeByBitLength,
578
+ X as getRandPrimeByRange,
579
+ G as getRndInt,
566
580
  a as isEqual,
567
- D as isNode,
568
- j as isSquare,
581
+ J as isNode,
582
+ x as isSquare,
569
583
  w as jacobiSymbol,
570
- L as lazify,
584
+ D as lazify,
571
585
  p as modPow,
572
- $ as parseCSV,
573
- F as promiseWithResolvers,
586
+ K as parseCSV,
587
+ $ as promiseWithResolvers,
574
588
  d as residue,
575
- U as rot32,
576
- W as rot32BI,
589
+ v as rot32,
590
+ Z as rot32BI,
577
591
  _ as sameValueZero,
578
- O as sleep,
579
- X as u8ArrToBI,
580
- V as u8ArrToBase64,
581
- Y as u8ArrToBase64Url
592
+ q as sleep,
593
+ tt as u8ArrToBI,
594
+ O as u8ArrToBase64,
595
+ nt as u8ArrToBase64Url
582
596
  };
@@ -10,7 +10,9 @@ export type PromiseData<T> = {
10
10
  };
11
11
  export declare class Executer<T> {
12
12
  #private;
13
+ static get name(): 'Executer';
14
+ get [Symbol.toStringTag](): "Executer";
13
15
  constructor(promise: Promise<T>);
14
- peer(): T;
16
+ get(): T;
15
17
  static boundary<TArg extends unknown[]>(func: (...args: TArg) => void): (...args: TArg) => void;
16
18
  }
@@ -5,7 +5,8 @@ export type RationalData = {
5
5
  };
6
6
  export declare class Rational {
7
7
  #private;
8
- get [Symbol.toStringTag](): string;
8
+ static get name(): 'Rational';
9
+ get [Symbol.toStringTag](): "Rational";
9
10
  /**
10
11
  *
11
12
  * @param numerator
package/dist/main.d.ts CHANGED
@@ -4,6 +4,5 @@ export * from './pcg-minimal';
4
4
  export * from './baillie-psw';
5
5
  export * from './fraction';
6
6
  export * from './u8arr-ext';
7
- export * from './brand';
8
7
  export * from './queue';
9
8
  export * from './executer';
@@ -3,7 +3,8 @@
3
3
  */
4
4
  export declare class PCGMinimal {
5
5
  #private;
6
- get [Symbol.toStringTag](): string;
6
+ static get name(): 'PCGMinimal';
7
+ get [Symbol.toStringTag](): "PCGMinimal";
7
8
  /** シード値の配列を返す */
8
9
  static getSeed(): BigUint64Array<ArrayBuffer>;
9
10
  /**
package/dist/queue.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export declare class Queue<T> {
2
2
  #private;
3
- get [Symbol.toStringTag](): string;
3
+ static get name(): 'Queue';
4
+ get [Symbol.toStringTag](): "Queue";
4
5
  constructor(...data: T[]);
5
6
  enqueue(...data: T[]): number;
6
7
  dequeue(): T | undefined;
package/dist/util.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ * compare two objects with SameValueZero method
3
+ * @param a
4
+ * @param b
5
+ * @returns
6
+ */
1
7
  declare const sameValueZero: (a: unknown, b: unknown) => boolean;
2
8
  /**
3
9
  * judges whether two objects has the same (nested) properties \
@@ -20,12 +26,12 @@ declare const promiseWithResolvers: <T>() => {
20
26
  */
21
27
  declare const sleep: (delay: number) => Promise<void>;
22
28
  /**
23
- * makes a function be lazy
29
+ * makes a function lazy
24
30
  */
25
31
  declare const lazify: <ArgT extends unknown[], RetT>(func: (...args: ArgT) => RetT) => (...args: ArgT) => () => RetT;
26
32
  /**
27
33
  * parses CSV string \
28
- * can deal with CSV with escaping doublequote
34
+ * able to deal with CSV with escaping doublequote
29
35
  * @param csv CSV
30
36
  * @returns 2次元配列
31
37
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tktb-tess/util-fns",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Utility functions for personal use",
5
5
  "files": [
6
6
  "dist"
@@ -8,9 +8,6 @@
8
8
  "type": "module",
9
9
  "author": "Tessyrrhaqt",
10
10
  "license": "MIT",
11
- "publishConfig": {
12
- "access": "public"
13
- },
14
11
  "main": "./dist/bundle.js",
15
12
  "types": "./dist/main.d.ts",
16
13
  "exports": {
@@ -18,30 +15,30 @@
18
15
  "import": "./dist/bundle.js"
19
16
  },
20
17
  "engines": {
21
- "node": ">=22.0.0"
18
+ "node": "^22",
19
+ "pnpm": "^10"
22
20
  },
23
21
  "repository": {
24
22
  "type": "git",
25
- "url": "https://github.com/tktb-tess/util-fns"
23
+ "url": "https://github.com/tktb-tess/util-fns.git"
26
24
  },
27
25
  "homepage": "https://github.com/tktb-tess/util-fns/blob/main/README.md",
28
- "scripts": {
29
- "dev": "vite",
30
- "build": "tsc && vite build",
31
- "test": "vitest run",
32
- "typecheck": "tsc --noEmit"
33
- },
34
26
  "devDependencies": {
35
- "@types/node": "^24.3.0",
27
+ "@types/node": "^24.6.2",
36
28
  "jsdom": "^26.1.0",
37
- "npm-check-updates": "^18.0.3",
38
- "tsx": "^4.20.5",
39
- "typescript": "^5.9.2",
40
- "vite": "^7.1.3",
29
+ "tsx": "^4.20.6",
30
+ "typescript": "^5.9.3",
31
+ "vite": "^7.1.9",
41
32
  "vite-plugin-dts": "^4.5.4",
42
33
  "vitest": "^3.2.4"
43
34
  },
44
35
  "volta": {
45
36
  "node": "22.19.0"
37
+ },
38
+ "scripts": {
39
+ "dev": "vite",
40
+ "build": "tsc && vite build",
41
+ "test": "vitest run",
42
+ "typecheck": "tsc --noEmit"
46
43
  }
47
- }
44
+ }