(key)
| 21 | } |
| 22 | |
| 23 | for(key) { |
| 24 | // Hot path: inline the map lookup to skip the `this.get(key)` |
| 25 | // indirection. This gets hit on every hook access in consumers |
| 26 | // like webpack. |
| 27 | const map = this._map; |
| 28 | const hook = map.get(key); |
| 29 | if (hook !== undefined) { |
| 30 | return hook; |
| 31 | } |
| 32 | let newHook = this._factory(key); |
| 33 | const interceptors = this._interceptors; |
| 34 | for (let i = 0; i < interceptors.length; i++) { |
| 35 | newHook = interceptors[i].factory(key, newHook); |
| 36 | } |
| 37 | map.set(key, newHook); |
| 38 | return newHook; |
| 39 | } |
| 40 | |
| 41 | intercept(interceptor) { |
| 42 | this._interceptors.push( |
no test coverage detected