object-sizeof
Advanced tools
Comparing version 2.4.1 to 2.4.2
@@ -6,11 +6,2 @@ // Copyright 2023 ChatGPT Jan 9 Version | ||
/** Is Node.js environment */ | ||
function isNode () { | ||
return ( | ||
typeof process === 'object' && | ||
typeof process.versions === 'object' && | ||
typeof process.versions.node !== 'undefined' | ||
) | ||
} | ||
/** | ||
@@ -73,8 +64,3 @@ * Size in bytes for complex objects | ||
} else if (typeof value === 'function') { | ||
if (isNode()) { | ||
const util = require('util') | ||
bytes += Buffer.byteLength(util.inspect(value), 'utf8') | ||
} else { | ||
bytes += value.toString().length | ||
} | ||
bytes += value.toString().length | ||
} else if (typeof value === 'object' && objectList.indexOf(value) === -1) { | ||
@@ -81,0 +67,0 @@ objectList.push(value) |
{ | ||
"name": "object-sizeof", | ||
"version": "2.4.1", | ||
"version": "2.4.2", | ||
"description": "Sizeof of a JavaScript object in Bytes", | ||
@@ -5,0 +5,0 @@ "main": "indexv2.js", |
## object-sizeof | ||
[![Build](https://img.shields.io/npm/v/object-sizeof)](https://img.shields.io/npm/v/object-sizeof) [![Build Status](https://travis-ci.org/miktam/sizeof.svg?branch=master)](https://travis-ci.org/miktam/sizeof) ![GitHub contributors](https://img.shields.io/github/contributors/miktam/sizeof) [![NPM](https://img.shields.io/npm/dy/object-sizeof)](https://img.shields.io/npm/dy/object-sizeof) [![codecov](https://codecov.io/gh/miktam/sizeof/branch/master/graph/badge.svg?token=qPHxmWpC1K)](https://codecov.io/gh/miktam/sizeof) | ||
[![Build](https://img.shields.io/npm/v/object-sizeof)](https://img.shields.io/npm/v/object-sizeof) ![GitHub contributors](https://img.shields.io/github/contributors/miktam/sizeof) [![NPM](https://img.shields.io/npm/dy/object-sizeof)](https://img.shields.io/npm/dy/object-sizeof) [![codecov](https://codecov.io/gh/miktam/sizeof/branch/master/graph/badge.svg?token=qPHxmWpC1K)](https://codecov.io/gh/miktam/sizeof) | ||
@@ -19,3 +19,3 @@ ### Get size of a JavaScript object in Bytes | ||
- Function | ||
### Coding standards | ||
@@ -22,0 +22,0 @@ |
@@ -95,9 +95,2 @@ 'use strict' | ||
it('Function support', () => { | ||
const func = (one, two) => { | ||
return one + two | ||
} | ||
sizeof(func).should.equal(16) | ||
}) | ||
it('nested objects', () => { | ||
@@ -109,14 +102,3 @@ const obj = { a: 1, b: 2, c: 3 } | ||
}) | ||
}) | ||
describe('sizeof browser tests', function () { | ||
const versions = global.process.versions | ||
before(function () { | ||
delete global.process.versions | ||
}) | ||
after(function () { | ||
global.process.versions = versions | ||
}) | ||
it('Function support', () => { | ||
@@ -123,0 +105,0 @@ const func = (one, two) => { |
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
13679
10
273