Skip to content

Instantly share code, notes, and snippets.

@nikolaskhodov
Created February 21, 2023 18:52
Show Gist options
  • Select an option

  • Save nikolaskhodov/a958aaa976ae1e9a3e58a11eaeae95e6 to your computer and use it in GitHub Desktop.

Select an option

Save nikolaskhodov/a958aaa976ae1e9a3e58a11eaeae95e6 to your computer and use it in GitHub Desktop.
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