@byloth/core 2.2.4 → 2.2.5

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.esm.js CHANGED
@@ -682,7 +682,7 @@ class l {
682
682
  * const iterator = new SmartIterator<number>([-2, -1, 0, 1, 2]);
683
683
  * const result = iterator.take(3);
684
684
  *
685
- * console.log(result.toArray()); // [-2, -1, 0]
685
+ * console.log(result.toArray()); // [-2, -1, 0]
686
686
  * console.log(iterator.toArray()); // [1, 2]
687
687
  * ```
688
688
  *
@@ -2593,7 +2593,7 @@ class m {
2593
2593
  * const iterator = new SmartAsyncIterator<number>([-2, -1, 0, 1, 2]);
2594
2594
  * const result = iterator.take(3);
2595
2595
  *
2596
- * console.log(await result.toArray()); // [-2, -1, 0]
2596
+ * console.log(await result.toArray()); // [-2, -1, 0]
2597
2597
  * console.log(await iterator.toArray()); // [1, 2]
2598
2598
  * ```
2599
2599
  *
@@ -3749,7 +3749,7 @@ class g {
3749
3749
  * context.subscribe("player:spawn", () => console.log("Player has spawned."));
3750
3750
  *
3751
3751
  * publisher.publish("player:spawn"); // "Player has spawned."
3752
- * context.publish("player:death"); // * no output *
3752
+ * context.publish("player:death"); // * no output *
3753
3753
  * ```
3754
3754
  *
3755
3755
  * ---
@@ -4175,7 +4175,7 @@ class Z extends Array {
4175
4175
  * ```ts
4176
4176
  * array.onAdd((value, index) => console.log(`Added ${value} at index ${index}`));
4177
4177
  *
4178
- * array.push(2); // "Added 2 at index 0"
4178
+ * array.push(2); // "Added 2 at index 0"
4179
4179
  * array.push(42); // "Added 42 at index 1"
4180
4180
  * ```
4181
4181
  *
@@ -4197,7 +4197,7 @@ class Z extends Array {
4197
4197
  * ```ts
4198
4198
  * array.onRemove((value, index) => console.log(`Removed ${value} at index ${index}`));
4199
4199
  *
4200
- * array.pop(); // "Removed 8 at index 2"
4200
+ * array.pop(); // "Removed 8 at index 2"
4201
4201
  * array.shift(); // "Removed 2 at index 0"
4202
4202
  * ```
4203
4203
  *
@@ -4333,7 +4333,7 @@ class W extends Map {
4333
4333
  * ```ts
4334
4334
  * map.onAdd((key, value) => console.log(`Added ${key}: ${value}`));
4335
4335
  *
4336
- * map.set("key1", 2); // "Added key1: 2"
4336
+ * map.set("key1", 2); // "Added key1: 2"
4337
4337
  * map.set("answer", 42); // "Added answer: 42"
4338
4338
  * ```
4339
4339
  *
@@ -4355,7 +4355,7 @@ class W extends Map {
4355
4355
  * ```ts
4356
4356
  * map.onRemove((key, value) => console.log(`Removed ${key}: ${value}`));
4357
4357
  *
4358
- * map.delete("key1"); // "Removed key1: 2"
4358
+ * map.delete("key1"); // "Removed key1: 2"
4359
4359
  * map.delete("answer"); // "Removed answer: 42"
4360
4360
  * ```
4361
4361
  *
@@ -4447,7 +4447,7 @@ class U extends Set {
4447
4447
  * @example
4448
4448
  * ```ts
4449
4449
  * const set = new SetView<number>([2, 4, 8]);
4450
- * set.delete(4); // true
4450
+ * set.delete(4); // true
4451
4451
  * set.delete(16); // false
4452
4452
  *
4453
4453
  * console.log(set); // SetView(2) { 2, 8 }
@@ -4489,7 +4489,7 @@ class U extends Set {
4489
4489
  * ```ts
4490
4490
  * set.onAdd((value) => console.log(`Added ${value}`));
4491
4491
  *
4492
- * set.add(2); // "Added 2"
4492
+ * set.add(2); // "Added 2"
4493
4493
  * set.add(42); // "Added 42"
4494
4494
  * ```
4495
4495
  *
@@ -4511,7 +4511,7 @@ class U extends Set {
4511
4511
  * ```ts
4512
4512
  * set.onRemove((value) => console.log(`Removed ${value}`));
4513
4513
  *
4514
- * set.delete(2); // "Removed 2"
4514
+ * set.delete(2); // "Removed 2"
4515
4515
  * set.delete(42); // "Removed 42"
4516
4516
  * ```
4517
4517
  *
@@ -4862,14 +4862,14 @@ class w {
4862
4862
  *
4863
4863
  * @example
4864
4864
  * ```ts
4865
- * const request = fetch("https://api.example.com/data");
4866
- * const smartRequest = SmartPromise.FromPromise(request);
4865
+ * const response = fetch("https://api.example.com/data");
4866
+ * const smartResponse = SmartPromise.FromPromise(response);
4867
4867
  *
4868
- * console.log(request.isPending); // Throws an error: `isPending` is not a property of `Promise`.
4869
- * console.log(smartRequest.isPending); // true
4868
+ * console.log(response.isPending); // Throws an error: `isPending` is not a property of `Promise`.
4869
+ * console.log(smartResponse.isPending); // true
4870
4870
  *
4871
- * const response = await request;
4872
- * console.log(smartRequest.isFulfilled); // true
4871
+ * const response = await response;
4872
+ * console.log(smartResponse.isFulfilled); // true
4873
4873
  * ```
4874
4874
  *
4875
4875
  * ---
@@ -4971,8 +4971,8 @@ class w {
4971
4971
  *
4972
4972
  *
4973
4973
  * promise
4974
- * .then(() => console.log("OK!")) // Logs "OK!" if the promise is fulfilled.
4975
- * .catch(() => console.log("KO!")) // Logs "KO!" if the promise is rejected.
4974
+ * .then(() => console.log("OK!")) // Logs "OK!" if the promise is fulfilled.
4975
+ * .catch(() => console.log("KO!")) // Logs "KO!" if the promise is rejected.
4976
4976
  * .finally(() => console.log("Done!")); // Always logs "Done!".
4977
4977
  * ```
4978
4978
  *
@@ -5920,7 +5920,12 @@ function be(i, e) {
5920
5920
  throw new c("The sum of weights must be greater than zero.");
5921
5921
  return t / n;
5922
5922
  }
5923
- function ye(i) {
5923
+ function ye(i, e, t) {
5924
+ if (e > t)
5925
+ throw new c("The minimum bound must be less than or equal to the maximum bound.");
5926
+ return i < e ? e : i > t ? t : i;
5927
+ }
5928
+ function xe(i) {
5924
5929
  let e = 0;
5925
5930
  for (let t = 0; t < i.length; t += 1) {
5926
5931
  const n = i.charCodeAt(t);
@@ -5928,16 +5933,16 @@ function ye(i) {
5928
5933
  }
5929
5934
  return e;
5930
5935
  }
5931
- function xe(i) {
5936
+ function ge(i) {
5932
5937
  let e = 0;
5933
5938
  for (const t of i)
5934
5939
  e += t;
5935
5940
  return e;
5936
5941
  }
5937
- function ge(i) {
5942
+ function ve(i) {
5938
5943
  return `${i.charAt(0).toUpperCase()}${i.slice(1)}`;
5939
5944
  }
5940
- const ve = "2.2.4";
5945
+ const Se = "2.2.5";
5941
5946
  export {
5942
5947
  _ as AggregatedAsyncIterator,
5943
5948
  d as AggregatedIterator,
@@ -5978,12 +5983,13 @@ export {
5978
5983
  O as TimedPromise,
5979
5984
  N as TimeoutException,
5980
5985
  Q as TypeException,
5981
- ve as VERSION,
5986
+ Se as VERSION,
5982
5987
  c as ValueException,
5983
5988
  $ as WeekDay,
5984
5989
  be as average,
5985
- ge as capitalize,
5990
+ ve as capitalize,
5986
5991
  fe as chain,
5992
+ ye as clamp,
5987
5993
  de as count,
5988
5994
  ne as dateDifference,
5989
5995
  se as dateRange,
@@ -5991,7 +5997,7 @@ export {
5991
5997
  le as delay,
5992
5998
  me as enumerate,
5993
5999
  re as getWeek,
5994
- ye as hash,
6000
+ xe as hash,
5995
6001
  E as isBrowser,
5996
6002
  B as isNode,
5997
6003
  V as isWorker,
@@ -5999,7 +6005,7 @@ export {
5999
6005
  ue as nextAnimationFrame,
6000
6006
  we as range,
6001
6007
  pe as shuffle,
6002
- xe as sum,
6008
+ ge as sum,
6003
6009
  _e as unique,
6004
6010
  ce as yieldToEventLoop,
6005
6011
  Y as zip