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.0.6 to 1.0.7

17

index.js

@@ -37,3 +37,3 @@ // Copyright 2014 Andrei Karpushonak

* Calculates Bytes for the provided parameter
* @param object - handles object/string/boolean
* @param object - handles object/string/boolean/buffer
* @returns {*}

@@ -46,6 +46,11 @@ */

if (_.isObject(object)) {
var stats = new Stats();
collectKeysValues(object, stats);
// calculate size in Bytes based on ECMAScript Language Specs
bytes = stats.calculateBytes();
if (Buffer.isBuffer(object)) {
bytes = object.length;
}
else {
var stats = new Stats();
collectKeysValues(object, stats);
// calculate size in Bytes based on ECMAScript Language Specs
bytes = stats.calculateBytes();
}
} else if (_.isString(object)) {

@@ -61,2 +66,2 @@ bytes = object.length * ECMA_SIZES.STRING;

module.exports = sizeof;
module.exports = sizeof;
{
"name": "object-sizeof",
"version": "1.0.6",
"version": "1.0.7",
"description": "Sizeof of a JavaScript object in bytes",

@@ -23,8 +23,8 @@ "main": "index.js",

"dependencies": {
"lodash": "^3.9.1"
"lodash": "^3.10.1"
},
"devDependencies": {
"mocha": "~1.19.0",
"should": "~3.3.1"
"mocha": "~2.3.4",
"should": "~8.0.2"
}
}

@@ -41,2 +41,6 @@ "use strict";

});
it('buffer size should be correct', function() {
sizeof(new Buffer(3)).should.be.equal(3);
});

@@ -60,2 +64,2 @@ it('nested objects shall be counted in full', function() {

})
})
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