Created
October 7, 2019 20:10
-
-
Save vitaly-t/864cf223b00f9a25ec4d56a72e7a6a5f 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
// 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