Skip to content

Instantly share code, notes, and snippets.

@vitaly-t
Created October 7, 2019 20:10
Show Gist options
  • Save vitaly-t/864cf223b00f9a25ec4d56a72e7a6a5f to your computer and use it in GitHub Desktop.
Save vitaly-t/864cf223b00f9a25ec4d56a72e7a6a5f to your computer and use it in GitHub Desktop.
// Works the same as JSON.stringify,
// but also handles BigInt type:
function stringify(value) {
if (value !== undefined) {
return JSON.stringify(value, (_, v) => typeof v === 'bigint' ? v.toString() : v);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment