Created
February 21, 2023 18:52
-
-
Save nikolaskhodov/a958aaa976ae1e9a3e58a11eaeae95e6 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
| export function record(type: string, object: any) { | |
| const recordsByType: Record<string, any[]> = global.___recorded || {} | |
| if (!global.___recorded) { | |
| global.___recorded = recordsByType | |
| } | |
| if (!recordsByType[type]) { | |
| recordsByType[type] = [] | |
| } | |
| recordsByType[type].push(object) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment