Last active
April 2, 2026 23:03
-
-
Save romgrk/fccab9852df0aeceb05b321a5296ad7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function devmodeStringHash(input: object | string | number | null) { | |
| let nextId = 0; | |
| const seen = new WeakMap<any, number>(); | |
| return JSON.stringify(input, (_, v) => { | |
| if (v !== null && typeof v === 'object') { | |
| const id = seen.get(v); | |
| if (id !== undefined) { | |
| return `__object__:${id}`; | |
| } | |
| seen.set(v, nextId); | |
| nextId += 1; | |
| } | |
| return v; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment