miktam / sizeof

Get size of a JavaScript object

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SizeOf returns NAN when object has a property that is null.

michaelbushby opened this issue · comments

//Sorry my first issue wasn't clear Please see the below example.

var _ = require('lodash');
var sizeof = require('object-sizeof');

var badData = {"1":{"depot_id":null,"hierarchy_node_id":null}};

var foo = sizeof(badData);
if(_.isNaN(foo)) {
console.log("I Am NAN");
console.log(JSON.stringify(badData));
} else {
console.log("I Am OK");
}

@michaelbushby you are absolutely right, I will fix it