Skip to content

Instantly share code, notes, and snippets.

@zGrav
Created March 12, 2018 14:54
Show Gist options
  • Save zGrav/79449d714b9cab7907281df58d38ba01 to your computer and use it in GitHub Desktop.
Save zGrav/79449d714b9cab7907281df58d38ba01 to your computer and use it in GitHub Desktop.
const objectParse = JSON.parse(stringify, (k, v) => {
if (
v !== null &&
typeof v === 'object' &&
'type' in v &&
v.type === 'Buffer' &&
'data' in v &&
Array.isArray(v.data)) {
return new Buffer(v.data);
}
return v;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment