(obj: any, spaces?: number)
| 418 | |
| 419 | // JSON.stringify version that can serialize otherwise unsupported types (bigint and Uint8Array) |
| 420 | export const extendedStringify = (obj: any, spaces?: number): string => JSON.stringify( |
| 421 | obj, |
| 422 | (_, v) => { |
| 423 | if (typeof v === 'bigint') { |
| 424 | return `${v.toString()}`; |
| 425 | } |
| 426 | if (v instanceof Uint8Array) { |
| 427 | return `${binToHex(v)}`; |
| 428 | } |
| 429 | return v; |
| 430 | }, |
| 431 | spaces, |
| 432 | ); |
| 433 | |
| 434 | export const zip = <T, U>(a: readonly T[], b: readonly U[]): [T, U][] => ( |
| 435 | Array.from(Array(Math.max(b.length, a.length)), (_, i) => [a[i], b[i]]) |
no test coverage detected