(a: any, b: any)
| 241 | * Compare two values for equality, with special handling for Uint8Arrays and Buffers |
| 242 | */ |
| 243 | export function areValuesEqual(a: any, b: any): boolean { |
| 244 | // Fast path for reference equality |
| 245 | if (a === b) { |
| 246 | return true |
| 247 | } |
| 248 | |
| 249 | // Check for Uint8Array/Buffer comparison |
| 250 | const aIsUint8Array = |
| 251 | (typeof Buffer !== `undefined` && a instanceof Buffer) || |
| 252 | a instanceof Uint8Array |
| 253 | const bIsUint8Array = |
| 254 | (typeof Buffer !== `undefined` && b instanceof Buffer) || |
| 255 | b instanceof Uint8Array |
| 256 | |
| 257 | // If both are Uint8Arrays, compare by content |
| 258 | if (aIsUint8Array && bIsUint8Array) { |
| 259 | return areUint8ArraysEqual(a, b) |
| 260 | } |
| 261 | |
| 262 | // Different types or not Uint8Arrays |
| 263 | return false |
| 264 | } |
no test coverage detected