js-sizeof
v0.0.1
Published
A small, dependency-free library to calculate the rough size of a javascript object in memory.
Downloads
1,571
Readme
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