Created
July 26, 2022 07:00
-
-
Save aroesler-privat/305cedf41fd5a9df686a5b47f80a69fb to your computer and use it in GitHub Desktop.
Small function to estimate the size of an array
This file contains 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
/* ------------------------------------------------------------------------- | |
https://stackoverflow.com/a/19354869 | |
------------------------------------------------------------------------- */ | |
function estimateObjectSize(obj) | |
{ | |
let buffer = JSON.stringify(obj).replace(/[\[\]\,\"]/g,''); | |
return buffer.length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment