MCPcopy Index your code
hub / github.com/immutable-js/immutable-js / _buildIndex

Method _buildIndex

src/Map.js:462–476  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

460 // Builds and memoizes the secondary index. A plain object, not `Map` — which
461 // in this module resolves to the *Immutable* Map, not the native one.
462 _buildIndex() {
463 const index = Object.create(null);
464 const entries = this.entries;
465 for (let ii = 0, len = entries.length; ii < len; ii++) {
466 const secondaryHash = hashCollisionKey(entries[ii][0]);
467 const positions = index[secondaryHash];
468 if (positions !== undefined) {
469 positions.push(ii);
470 } else {
471 index[secondaryHash] = [ii];
472 }
473 }
474 this._index = index;
475 return index;
476 }
477
478 get(shift, keyHash, key, notSetValue) {
479 const idx = this._positionOf(key, true);

Callers 1

_positionOfMethod · 0.95

Calls 2

hashCollisionKeyFunction · 0.90
pushMethod · 0.65

Tested by

no test coverage detected