MCPcopy
hub / github.com/webpack/webpack / boundFn

Function boundFn

lib/util/identifier.js:235–251  ·  view source on GitHub ↗
(context, identifier)

Source from the content-addressed store, hash-verified

233 * @returns {string} the returned relative path
234 */
235 const boundFn = (context, identifier) => {
236 /** @type {undefined | string} */
237 let cachedResult;
238 let innerSubCache = innerCache.get(context);
239 if (innerSubCache === undefined) {
240 innerCache.set(context, (innerSubCache = new Map()));
241 } else {
242 cachedResult = innerSubCache.get(identifier);
243 }
244
245 if (cachedResult !== undefined) {
246 return cachedResult;
247 }
248 const result = fn(context, identifier);
249 innerSubCache.set(identifier, result);
250 return result;
251 };
252
253 return boundFn;
254 };

Callers

nothing calls this directly

Calls 3

fnFunction · 0.70
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected