Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object-sizeof

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-sizeof - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

6

index.js

@@ -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

8

package.json
{
"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)
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc