miktam / sizeof

Get size of a JavaScript object
MIT License
311 stars 45 forks source link

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

Closed michaelbushby closed 9 years ago

michaelbushby commented 9 years ago

//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"); }

miktam commented 9 years ago

@michaelbushby you are absolutely right, I will fix it