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

Function hashCollisionKey

src/Hash.ts:111–120  ·  view source on GitHub ↗
(key: unknown)

Source from the content-addressed store, hash-verified

109// candidates — `is()` still decides equality — so non-string keys can safely
110// fall back to the (here constant) primary hash and a linear scan.
111export function hashCollisionKey(key: unknown): number {
112 if (typeof key !== 'string') {
113 return hash(key);
114 }
115 let hashed = 0;
116 for (let ii = 0; ii < key.length; ii++) {
117 hashed = (COLLISION_HASH_BASE * hashed + key.charCodeAt(ii)) | 0;
118 }
119 return hashed;
120}
121
122function hashSymbol(sym: symbol): number {
123 let hashed = symbolMap[sym];

Callers 3

_positionOfMethod · 0.90
_buildIndexMethod · 0.90
updateMethod · 0.90

Calls 1

hashFunction · 0.85

Tested by

no test coverage detected