aveazul 2.1.4 → 2.1.6

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/aveazul.d.ts CHANGED
@@ -143,7 +143,7 @@ declare class AveAzul<T> extends Promise<T> {
143
143
  * @param ms - Milliseconds to delay
144
144
  * @returns Promise that resolves after the delay
145
145
  */
146
- delay(ms: number): AveAzul<void>;
146
+ delay(ms: number): AveAzul<T>;
147
147
  /**
148
148
  * Bluebird-style timeout() method
149
149
  * @param ms - Milliseconds before timeout
package/dist/aveazul.js CHANGED
@@ -101,7 +101,7 @@ class AveAzul extends Promise {
101
101
  * @returns Promise that resolves after the delay
102
102
  */
103
103
  delay(ms) {
104
- return xaa.delay(ms);
104
+ return this.then((value) => AveAzul.delay(ms, value));
105
105
  }
106
106
  /**
107
107
  * Bluebird-style timeout() method
@@ -141,8 +141,8 @@ class AveAzul extends Promise {
141
141
  * @returns Promise that maintains the rejection
142
142
  */
143
143
  tapCatch(fn) {
144
- return this.catch((err) => {
145
- fn(err);
144
+ return this.catch(async (err) => {
145
+ await fn(err);
146
146
  throw err;
147
147
  });
148
148
  }
@@ -185,7 +185,9 @@ class AveAzul extends Promise {
185
185
  * @returns Promise that rejects with the given reason
186
186
  */
187
187
  throw(reason) {
188
- return AveAzul.reject(reason);
188
+ return this.then(() => {
189
+ throw reason;
190
+ });
189
191
  }
190
192
  /**
191
193
  * Bluebird-style catchThrow() that catches an error and throws a new one
@@ -249,6 +251,12 @@ class AveAzul extends Promise {
249
251
  });
250
252
  }
251
253
  some(count) {
254
+ if ((count | 0) !== count || count < 0) {
255
+ return AveAzul.reject(new TypeError("expecting a non-negative integer"));
256
+ }
257
+ if (count === 0) {
258
+ return AveAzul.resolve([]);
259
+ }
252
260
  return this.then((args) => {
253
261
  const arr = toArray(args);
254
262
  return new AveAzul((resolve, reject) => {
@@ -261,6 +269,10 @@ class AveAzul extends Promise {
261
269
  const results = [];
262
270
  const len = arr.length;
263
271
  let settled = false;
272
+ if (count > len) {
273
+ settled = true;
274
+ reject(new RangeError(`Input array must contain at least ${count} items but contains only ${len} items`));
275
+ }
264
276
  const addDone = (result) => {
265
277
  if (settled)
266
278
  return;
@@ -600,7 +612,7 @@ AveAzul.isProgrammerError = isProgrammerError;
600
612
  AveAzul.Disposer = Disposer;
601
613
  // Setup the any method
602
614
  import { addStaticAny } from "./any.js";
603
- addStaticAny(AveAzul);
615
+ addStaticAny(AveAzul, true);
604
616
  // Setup the not implemented methods
605
617
  import { setupNotImplemented } from "./not-implemented.js";
606
618
  setupNotImplemented(AveAzul);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aveazul",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "Bluebird drop-in replacement built on native Promise",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -80,16 +80,16 @@
80
80
  "directory": "packages/aveazul"
81
81
  },
82
82
  "dependencies": {
83
- "@jchip/error": "^2.1.3",
84
- "xaa": "^3.1.3"
83
+ "@jchip/error": "^2.1.5",
84
+ "xaa": "^3.1.5"
85
85
  },
86
86
  "devDependencies": {
87
- "@fynjs/ts-resolve": "^1.0.2",
87
+ "@fynjs/ts-resolve": "^1.0.3",
88
88
  "@types/node": "^26.4.1",
89
89
  "@vitest/coverage-v8": "^5.0.0",
90
90
  "bluebird": "^3.7.2",
91
- "publish-util": "^3.1.3",
92
- "run-verify": "^2.1.4",
91
+ "publish-util": "^3.1.5",
92
+ "run-verify": "^2.1.6",
93
93
  "typescript": "^7.0.2",
94
94
  "vite": "^8.2.2",
95
95
  "vitest": "^5.0.0"