MCPcopy
hub / github.com/webpack/tapable / withOptions

Method withOptions

lib/Hook.js:144–157  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

142 }
143
144 withOptions(options) {
145 const mergeOptions = (opt) =>
146 Object.assign({}, options, typeof opt === "string" ? { name: opt } : opt);
147
148 return {
149 name: this.name,
150 tap: (opt, fn) => this.tap(mergeOptions(opt), fn),
151 tapAsync: (opt, fn) => this.tapAsync(mergeOptions(opt), fn),
152 tapPromise: (opt, fn) => this.tapPromise(mergeOptions(opt), fn),
153 intercept: (interceptor) => this.intercept(interceptor),
154 isUsed: () => this.isUsed(),
155 withOptions: (opt) => this.withOptions(mergeOptions(opt))
156 };
157 }
158
159 isUsed() {
160 return this.taps.length > 0 || this.interceptors.length > 0;

Callers 2

Hook.test.jsFile · 0.45
MultiHook.test.jsFile · 0.45

Calls 5

tapMethod · 0.95
tapAsyncMethod · 0.95
tapPromiseMethod · 0.95
interceptMethod · 0.95
isUsedMethod · 0.95

Tested by

no test coverage detected