Launch Week Day 1: Socket for Jira Is Now Available.Learn More
Socket
Book a DemoSign in
Socket

js-sizeof

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-sizeof

A small, dependency-free library to calculate the rough size of a javascript object in memory.

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

js-sizeof

NPM version Build Status Coverage Status

A small (<50 loc), dependency-free library to calculate the rough size of a javascript object in memory.

Installation

npm install js-sizeof

Usage

    var sizeof = require( 'js-sizeof' );

    var obj = {
        floop: 0,
        gloop: 'gloop!',
        ploop: [ 1, 2, 3 ]
    };
    
    var foo = {
        bar: {
            fiz: 1,
            baz: 'hi!',
            buz: [ 1, 2, 3 ]
        },
        bloop: obj,
        otherBloop: obj, // shouldn't end up counted twice
    };
    
    console.log( sizeof( foo ) );

CHANGELOG

0.0.1

  • Initial revision
    • I wanted a really small, dependency free library to get the size of objects
    • Other options either had crazy dependencies or were more than just sizeof

Keywords

sizeof

FAQs

Package last updated on 25 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts