MCPcopy
hub / github.com/webpack/webpack / set

Method set

lib/util/runtime.js:514–539  ·  view source on GitHub ↗

* Updates default using the provided runtime. * @param {RuntimeSpec} runtime the runtimes * @param {R} value the value

(runtime, value)

Source from the content-addressed store, hash-verified

512 * @param {R} value the value
513 */
514 set(runtime, value) {
515 switch (this._mode) {
516 case 0:
517 this._mode = 1;
518 this._singleRuntime = runtime;
519 this._singleValue = value;
520 break;
521 case 1:
522 if (runtimeEqual(this._singleRuntime, runtime)) {
523 this._singleValue = value;
524 break;
525 }
526 this._mode = 2;
527 this._map = new Map();
528 this._map.set(
529 getRuntimeKey(this._singleRuntime),
530 /** @type {R} */ (this._singleValue)
531 );
532 this._singleRuntime = undefined;
533 this._singleValue = undefined;
534 /* falls through */
535 default:
536 /** @type {RuntimeSpecMapInnerMap<R>} */
537 (this._map).set(getRuntimeKey(runtime), value);
538 }
539 }
540
541 /**
542 * Returns the new value.

Callers 4

provideMethod · 0.45
updateMethod · 0.45
addMethod · 0.45

Calls 2

runtimeEqualFunction · 0.85
getRuntimeKeyFunction · 0.85

Tested by

no test coverage detected