object-sizeof
Advanced tools
Comparing version
@@ -21,3 +21,4 @@ // Copyright 2014 Andrei Karpushonak | ||
for (var key in object) { | ||
if (!object.hasOwnProperty(key)) { | ||
if(!Object.hasOwnProperty.call(object, key)) { | ||
continue; | ||
@@ -24,0 +25,0 @@ } |
{ | ||
"name": "object-sizeof", | ||
"version": "1.1.0", | ||
"description": "Sizeof of a JavaScript object in bytes", | ||
"version": "1.1.1", | ||
"description": "Sizeof of a JavaScript object in Bytes", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
@@ -12,5 +12,3 @@ "use strict"; | ||
var badData = {"1":{"depot_id":null,"hierarchy_node_id":null}}; | ||
console.log('size', sizeof(badData)); | ||
sizeof(badData); | ||
isNaN(sizeof(badData)).should.be.equal(false); | ||
sizeof(badData).should.be.instanceOf(Number); | ||
}); | ||
@@ -70,2 +68,8 @@ | ||
it('handle hasOwnProperty key', function() { | ||
sizeof({hasOwnProperty: undefined}).should.be.instanceOf(Number); | ||
sizeof({hasOwnProperty: 'Hello World'}).should.be.instanceOf(Number); | ||
sizeof({hasOwnProperty: 1234}).should.be.instanceOf(Number); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
7118
3.17%109
2.83%