(input: object, marker: number)
| 136 | } |
| 137 | |
| 138 | function hashPlainObject(input: object, marker: number): number { |
| 139 | const hasher = new MurmurHashStream() |
| 140 | |
| 141 | // Mark the type of the input |
| 142 | hasher.update(marker) |
| 143 | const keys = Object.keys(input) |
| 144 | keys.sort(keySort) |
| 145 | for (const key of keys) { |
| 146 | hasher.update(KEY) |
| 147 | hasher.update(key) |
| 148 | updateHasher(hasher, input[key as keyof typeof input]) |
| 149 | } |
| 150 | |
| 151 | return hasher.digest() |
| 152 | } |
| 153 | |
| 154 | function updateHasher(hasher: Hasher, input: unknown): void { |
| 155 | if (input === null) { |
no test coverage detected