var_dump

Implementation of PHP's var_dump function for JavaScript.

Usage no npm install needed!

<script type="module">
  import varDump from 'https://cdn.skypack.dev/var_dump';
</script>

README

var_dump

Implementation of PHP's var_dump function for JavaScript.

JavaScript Style Guide

Version npm NPM Downloads License GitHub Repository Size JavaScript Style Guide

NPM

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"
                }
            }
        }
    }
}