(...args)
| 590 | throw new Error("not implemented"); |
| 591 | } |
| 592 | compose(...args) { |
| 593 | const interceptors = Array.isArray(args[0]) ? args[0] : args; |
| 594 | let dispatch = this.dispatch.bind(this); |
| 595 | for (const interceptor of interceptors) { |
| 596 | if (interceptor == null) { |
| 597 | continue; |
| 598 | } |
| 599 | if (typeof interceptor !== "function") { |
| 600 | throw new TypeError(`invalid interceptor, expected function received ${typeof interceptor}`); |
| 601 | } |
| 602 | dispatch = interceptor(dispatch); |
| 603 | if (dispatch == null || typeof dispatch !== "function" || dispatch.length !== 2) { |
| 604 | throw new TypeError("invalid interceptor"); |
| 605 | } |
| 606 | } |
| 607 | return new Proxy(this, { |
| 608 | get: /* @__PURE__ */ __name((target, key) => key === "dispatch" ? dispatch : target[key], "get") |
| 609 | }); |
| 610 | } |
| 611 | }; |
| 612 | module2.exports = Dispatcher2; |
| 613 | } |
no test coverage detected