hookable 5.5.2 → 5.5.3

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
@@ -66,7 +66,7 @@ function parallelCaller(hooks, args) {
66
66
  return Promise.all(hooks.map((hook) => hook(...args || [])));
67
67
  }
68
68
  function callEachWith(callbacks, arg0) {
69
- for (const callback of callbacks) {
69
+ for (const callback of [...callbacks]) {
70
70
  callback(arg0);
71
71
  }
72
72
  }
@@ -197,7 +197,10 @@ class Hookable {
197
197
  if (this._before) {
198
198
  callEachWith(this._before, event);
199
199
  }
200
- const result = caller(this._hooks[name] || [], arguments_);
200
+ const result = caller(
201
+ name in this._hooks ? [...this._hooks[name]] : [],
202
+ arguments_
203
+ );
201
204
  if (result instanceof Promise) {
202
205
  return result.finally(() => {
203
206
  if (this._after && event) {
package/dist/index.mjs CHANGED
@@ -64,7 +64,7 @@ function parallelCaller(hooks, args) {
64
64
  return Promise.all(hooks.map((hook) => hook(...args || [])));
65
65
  }
66
66
  function callEachWith(callbacks, arg0) {
67
- for (const callback of callbacks) {
67
+ for (const callback of [...callbacks]) {
68
68
  callback(arg0);
69
69
  }
70
70
  }
@@ -195,7 +195,10 @@ class Hookable {
195
195
  if (this._before) {
196
196
  callEachWith(this._before, event);
197
197
  }
198
- const result = caller(this._hooks[name] || [], arguments_);
198
+ const result = caller(
199
+ name in this._hooks ? [...this._hooks[name]] : [],
200
+ arguments_
201
+ );
199
202
  if (result instanceof Promise) {
200
203
  return result.finally(() => {
201
204
  if (this._after && event) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hookable",
3
- "version": "5.5.2",
3
+ "version": "5.5.3",
4
4
  "description": "Awaitable hook system",
5
5
  "keywords": [
6
6
  "hook",
@@ -23,19 +23,19 @@
23
23
  "dist"
24
24
  ],
25
25
  "devDependencies": {
26
- "@types/node": "^18.15.3",
27
- "@vitest/coverage-c8": "^0.29.2",
28
- "changelogen": "^0.5.1",
29
- "eslint": "^8.36.0",
26
+ "@types/node": "^18.15.11",
27
+ "@vitest/coverage-c8": "^0.29.8",
28
+ "changelogen": "^0.5.2",
29
+ "eslint": "^8.37.0",
30
30
  "eslint-config-unjs": "^0.1.0",
31
31
  "expect-type": "^0.15.0",
32
- "prettier": "^2.8.4",
33
- "typescript": "^4.9.5",
32
+ "prettier": "^2.8.7",
33
+ "typescript": "^5.0.2",
34
34
  "unbuild": "^1.1.2",
35
35
  "vite": "^4.2.1",
36
- "vitest": "^0.29.2"
36
+ "vitest": "^0.29.8"
37
37
  },
38
- "packageManager": "pnpm@7.29.2",
38
+ "packageManager": "pnpm@8.0.0",
39
39
  "scripts": {
40
40
  "build": "unbuild",
41
41
  "dev": "vitest",