(key: unknown)
| 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. |
| 111 | export 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 | |
| 122 | function hashSymbol(sym: symbol): number { |
| 123 | let hashed = symbolMap[sym]; |
no test coverage detected