MCPcopy Create free account
hub / github.com/immutable-js/immutable-js / cachedHashString

Function cachedHashString

src/Hash.ts:70–82  ·  view source on GitHub ↗
(string: string)

Source from the content-addressed store, hash-verified

68}
69
70function cachedHashString(string: string): number {
71 let hashed = stringHashCache[string];
72 if (hashed === undefined) {
73 hashed = hashString(string);
74 if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
75 STRING_HASH_CACHE_SIZE = 0;
76 stringHashCache = {};
77 }
78 STRING_HASH_CACHE_SIZE++;
79 stringHashCache[string] = hashed;
80 }
81 return hashed;
82}
83
84// http://jsperf.com/hashing-strings
85function hashString(string: string): number {

Callers 1

hashFunction · 0.85

Calls 1

hashStringFunction · 0.85

Tested by

no test coverage detected