A small, dependency-free library to calculate the rough size of a javascript object in memory.
- JavaScript 100%
| tests | ||
| .gitignore | ||
| .jsbeautifyrc | ||
| .jshintrc | ||
| .travis.yml | ||
| index.js | ||
| package.json | ||
| README.md | ||
js-sizeof
A small (<50 loc), dependency-free library to calculate the rough size of a javascript object in memory.
Installation
npm install js-sizeof
Usage
var sizeof = require( 'js-sizeof' );
var obj = {
floop: 0,
gloop: 'gloop!',
ploop: [ 1, 2, 3 ]
};
var foo = {
bar: {
fiz: 1,
baz: 'hi!',
buz: [ 1, 2, 3 ]
},
bloop: obj,
otherBloop: obj, // shouldn't end up counted twice
};
console.log( sizeof( foo ) );
CHANGELOG
0.0.1
- Initial revision
- I wanted a really small, dependency free library to get the size of objects
- Other options either had crazy dependencies or were more than just sizeof


