MCPcopy
hub / github.com/webpack/webpack / mapObject

Function mapObject

lib/stats/DefaultStatsFactoryPlugin.js:411–418  ·  view source on GitHub ↗
(obj, fn)

Source from the content-addressed store, hash-verified

409 * @returns {MappedValues<T, R>} mapped object
410 */
411const mapObject = (obj, fn) => {
412 /** @type {MappedValues<T, R>} */
413 const newObj = Object.create(null);
414 for (const key of /** @type {(keyof T)[]} */ (Object.keys(obj))) {
415 newObj[key] = fn(obj[key], key);
416 }
417 return newObj;
418};
419
420/**
421 * Count with children.

Callers 1

Calls 3

keysMethod · 0.65
fnFunction · 0.50
createMethod · 0.45

Tested by

no test coverage detected