Skip to content

Instantly share code, notes, and snippets.

@aroesler-privat
Created July 26, 2022 07:00
Show Gist options
  • Save aroesler-privat/305cedf41fd5a9df686a5b47f80a69fb to your computer and use it in GitHub Desktop.
Save aroesler-privat/305cedf41fd5a9df686a5b47f80a69fb to your computer and use it in GitHub Desktop.
Small function to estimate the size of an array
/* -------------------------------------------------------------------------
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