Skip to content

Instantly share code, notes, and snippets.

@WimJongeneel
Created February 29, 2020 13:42
Show Gist options
  • Save WimJongeneel/6f4c256f50c3c10d53d847b2fa958e78 to your computer and use it in GitHub Desktop.
Save WimJongeneel/6f4c256f50c3c10d53d847b2fa958e78 to your computer and use it in GitHub Desktop.
const mutations_to_odata = <T>(entity: TrackedEntity<T>, model: string) : string => {
const obj = {
"@odata.type": model,
}
entity.mutations.forEach(m => {
obj[m.prop] = m.value
})
return JSON.stringify(obj, null, ' ')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment