Created
October 25, 2021 10:46
-
-
Save bradleykronson/7eefce91219cb4a982d826ce8fab8f10 to your computer and use it in GitHub Desktop.
Calculate size of object in session storage
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
var count = 0; | |
for (const property in app) { | |
try { | |
var l = JSON.stringify(app[property]).length; | |
count += l; | |
console.log(`${property}: ${l}`); | |
} catch(e) { | |
// meh | |
} | |
}; | |
console.log(`Total: ${count}`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment