object-sizeof
Advanced tools
Comparing version 1.4.0 to 1.5.0
@@ -54,3 +54,7 @@ // Copyright 2014 Andrei Karpushonak | ||
case 'object': | ||
return sizeOfObject(object) | ||
if (Array.isArray(object)) { | ||
return object.map(sizeof).reduce((acc, curr) => acc + curr) | ||
} else { | ||
return sizeOfObject(object) | ||
} | ||
default: | ||
@@ -57,0 +61,0 @@ return 0 |
{ | ||
"name": "object-sizeof", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Sizeof of a JavaScript object in Bytes", | ||
@@ -23,10 +23,10 @@ "main": "index.js", | ||
"dependencies": { | ||
"buffer": "^5.2.1" | ||
"buffer": "^5.4.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "^6.1.4", | ||
"mocha": "^6.2.0", | ||
"should": "^13.2.3", | ||
"standard": "^12.0.1" | ||
"standard": "^14.0.0" | ||
}, | ||
"types": "index.d.ts" | ||
} |
## object-sizeof | ||
[![Build Status](https://travis-ci.org/miktam/sizeof.svg?branch=master)](https://travis-ci.org/miktam/sizeof) [![Dependency Status](https://david-dm.org/miktam/sizeof.svg)](https://david-dm.org/miktam/sizeof) | ||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiktam%2Fsizeof.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmiktam%2Fsizeof?ref=badge_shield) | ||
@@ -49,2 +50,4 @@ [![NPM](https://nodei.co/npm/object-sizeof.png?downloads=true&downloadRank=true)](https://nodei.co/npm/object-sizeof/) | ||
Copyright (c) 2015, Andrei Karpushonak aka @miktam | ||
Copyright (c) 2015, Andrei Karpushonak aka @miktam | ||
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmiktam%2Fsizeof.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmiktam%2Fsizeof?ref=badge_large) |
@@ -10,3 +10,3 @@ 'use strict' | ||
it('should handle null in object keys', function () { | ||
var badData = { '1': { 'depot_id': null, 'hierarchy_node_id': null } } | ||
var badData = { 1: { depot_id: null, hierarchy_node_id: null } } | ||
sizeof(badData).should.be.instanceOf(Number) | ||
@@ -72,2 +72,14 @@ }) | ||
}) | ||
it('array support for strings', function () { | ||
sizeof(['a', 'b', 'c', 'd']).should.be.equal(8) | ||
}) | ||
it('array support for numbers', function () { | ||
sizeof([1, 2, 3, 4]).should.equal(32) | ||
}) | ||
it('array support for NaN', function () { | ||
sizeof([null, undefined, 3, 4]).should.equal(16) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7883
134
52
Updatedbuffer@^5.4.0