var_dump

Implementation of PHP's var_dump function for JavaScript.

MIT License

Downloads
995
Stars
10

var_dump

Implementation of PHP's var_dump function for JavaScript.

Installation

Either through cloning with git or by using npm (the recommended way):

npm install var_dump --save-dev

Usage

const var_dump = require('var_dump')

Use var_dump while development for printing details of variables and functions.

var variable = {
  'data': {
    'users': {
      'id': 12,
      'friends': [{
        'id': 1,
        'name': 'John Doe'
      }]
    }
  }
}

// print the variable using var_dump
var_dump(variable)

This will print:

object(1) {
    ["data"] => object(1) {
        ["users"] => object(2) {
            ["id"] => number(12)
            ["friends"] => array(1) {
                [0] => object(2) {
                    ["id"] => number(1)
                    ["name"] => string(8) "John Doe"
                }
            }
        }
    }
}