New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

prototype-stringify

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prototype-stringify

stringify simple object, including data in prototypes.

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

prototype-stringify

stringify simple object, including data in prototypes.

Install

npm install prototype-stringify

Usage


var a = { b: 1, c: { d: 2 }, e: { f: 3 } };
var aa = Object.create(a);

aa.bb = 11;
aa.c.dd = 22;
aa.e = Object.create(a.e);
aa.e.ff = 33;

var s1 = JSON.stringify(aa);		//JSON.stringify() exclude data in prototype
console.log("JSON.stringify():\n\t" + s1);
//{"bb":11,"e":{"ff":33}}

var s2 = prototype_stringify(aa);		//to include data in prototypes
console.log("prototype_stringify():\n\t" + s2);
//{"b":1,"bb":11,"c":{"d":2,"dd":22},"e":{"f":3,"ff":33}}

/*
var expect = {
    b: 1,
    bb: 11,
    c: {
        d: 2,
        dd: 22
    },
    e: {
        f: 3,
        ff: 33
    }
};
*/

Keywords

prototype

FAQs

Package last updated on 21 Oct 2021

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