Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dump-die

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dump-die

Dump an object and kill the process in node.js

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
94
increased by17.5%
Maintainers
1
Weekly downloads
 
Created
Source

dump-die

Latest Version on NPM Software License Build Status Code Climate

Dump an object and kill the process in node.js for quick debugging. Based on Laravel's dd() function.

Installation

npm install dump-die

Usage

Calling dd will print the object in your terminal and kill the process.

const dd = require('dump-die')

let myObject = {
    foo: 'bar',
    baz: function() {
        return 'Hi'
    }
}

Outputs:

{ foo: 'bar',
  baz:
   { [Function]
     [length]: 0,
     [name]: '',
     [prototype]: { [constructor]: [Circular] } } }

You can dump any amount of objects.

let foo = 'bar', hodor = { hodor: 'hodor' }
dd(foo, baz, hodor)

Outputs:

'bar'
{ hodor: 'hodor' }

If you don't want to kill the process, you can require the inspect function (which is a simple wrapper around node.js' util.inspect)

const inspect = require('dump-die/lib/inspect')

inspect({ foo: 'bar' }) // => '{ foo: \u001b[32m\'bar\'\u001b[39m }'

Testing

You can run the tests (ESLint & Mocha) with:

npm run test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.

Credits

About Spatie

Spatie is a webdesign agency in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.

License

The MIT License (MIT). Please see License File for more information.

Keywords

FAQs

Package last updated on 30 Nov 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

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