@tb-dev/utils 3.0.0 → 3.0.2

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/index.cjs CHANGED
@@ -53,11 +53,11 @@ function splitWhitespace(value) {
53
53
  function sleep(ms) {
54
54
  return new Promise((resolve) => void setTimeout(resolve, ms));
55
55
  }
56
- class PromiseChain {
56
+ class PromiseSet {
57
57
  constructor() {
58
58
  __publicField(this, "promises", /* @__PURE__ */ new Set());
59
59
  }
60
- chain(promise) {
60
+ and(promise) {
61
61
  this.promises.add(promise);
62
62
  return this;
63
63
  }
@@ -65,9 +65,6 @@ class PromiseChain {
65
65
  await Promise.all(this.promises);
66
66
  this.promises.clear();
67
67
  }
68
- static create() {
69
- return new PromiseChain();
70
- }
71
68
  }
72
69
  function flushPromises() {
73
70
  return new Promise((resolve) => void setTimeout(resolve, 0));
@@ -95,7 +92,7 @@ function toPixel(value) {
95
92
  }
96
93
  return value;
97
94
  }
98
- exports.PromiseChain = PromiseChain;
95
+ exports.PromiseSet = PromiseSet;
99
96
  exports.flushPromises = flushPromises;
100
97
  exports.isEmpty = isEmpty;
101
98
  exports.isNullish = isNullish;
package/dist/index.js CHANGED
@@ -51,11 +51,11 @@ function splitWhitespace(value) {
51
51
  function sleep(ms) {
52
52
  return new Promise((resolve) => void setTimeout(resolve, ms));
53
53
  }
54
- class PromiseChain {
54
+ class PromiseSet {
55
55
  constructor() {
56
56
  __publicField(this, "promises", /* @__PURE__ */ new Set());
57
57
  }
58
- chain(promise) {
58
+ and(promise) {
59
59
  this.promises.add(promise);
60
60
  return this;
61
61
  }
@@ -63,9 +63,6 @@ class PromiseChain {
63
63
  await Promise.all(this.promises);
64
64
  this.promises.clear();
65
65
  }
66
- static create() {
67
- return new PromiseChain();
68
- }
69
66
  }
70
67
  function flushPromises() {
71
68
  return new Promise((resolve) => void setTimeout(resolve, 0));
@@ -94,7 +91,7 @@ function toPixel(value) {
94
91
  return value;
95
92
  }
96
93
  export {
97
- PromiseChain,
94
+ PromiseSet,
98
95
  flushPromises,
99
96
  isEmpty,
100
97
  isNullish,
@@ -1,3 +1,3 @@
1
1
  export { sleep } from './sleep';
2
- export { PromiseChain } from './promise-chain';
2
+ export { PromiseSet } from './promise-set';
3
3
  export { flushPromises } from './flush-promises';
@@ -0,0 +1,5 @@
1
+ export declare class PromiseSet {
2
+ private readonly promises;
3
+ and(promise: Promise<any>): this;
4
+ join(): Promise<void>;
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tb-dev/utils",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "TypeScript utils",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +0,0 @@
1
- export declare class PromiseChain {
2
- private readonly promises;
3
- chain(promise: Promise<any>): this;
4
- join(): Promise<void>;
5
- static create(): PromiseChain;
6
- }