Socket
Socket
Sign inDemoInstall

abc-stringify

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abc-stringify

Safe, simple, configurable JSON.stringify


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Install size
7.56 kB
Created
Weekly downloads
 

Readme

Source

abc-stringify

Safe, simple, configurable JSON.stringify()

Handles recursive objects.

Handles Error objects and lets you specify your own error replacer function.

Allows array replacers to either include or exclude keys.

Allows you to specify a list of values to replace (think passwords and keys in your config).

Allows omitting the replacer parameter and just pass the space parameter.

Quick Start

let ss = new AbcStringify()
const o = {
  name: 'abc stringify',
  error: new Error('something bad happened'),
  address: {
    street: '123 string st',
    city: 'hershey',
    st: 'pa',
    zip: '17033'
  },
  nest: {
    really: {
      deep: {
        stuff: ['one', 2, {
          another: 'thing here'
        }]
      }
    }
  }
}
o.circular = o
console.log(ss.stringify(o, 2))

Output

{
  "name": "abc stringify",
  "error": {
    "name": "Error",
    "message": "something bad happened",
    "stack": "Error: something bad happened\n    at Object.<anonymous> (/abc-stringify/index.js:99:12)\n    at Module._compile (internal/modules/cjs/loader.js:776:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)\n    at Module.load (internal/modules/cjs/loader.js:653:32)\n    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)\n    at Function.Module._load (internal/modules/cjs/loader.js:585:3)\n    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)\n    at startup (internal/bootstrap/node.js:283:19)\n    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)"
  },
  "address": {
    "street": "123 string st",
    "city": "hershey",
    "st": "pa",
    "zip": "17033"
  },
  "nest": {
    "really": {
      "deep": {
        "stuff": [
          "one",
          2,
          {
            "another": "thing here"
          }
        ]
      }
    }
  },
  "circular": "--circular--"
}

Keywords

FAQs

Last updated on 27 Aug 2019

Did you know?

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

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc