Dumper.js
a PHP var_dump like library
Installation
Download Dumper.js from GitHub.
Include the dumper.js file (or dumper.min.js) in your webpage.
<script src="dumper.js"></script>
Usage
Dumper.js have toString()
and toHTML()
methods.
Dumper({foo: 'bar', baz: [1,2,3]}).toString(); // object (size=2) // foo => string 'bar' (length=3) // baz => // array (size=3) // 0 => number 1 // 1 => number 2 // 2 => number 3
NOTE toHTML()
method add colors and collapsible nodes
Dumper({foo: 'bar', baz: [1,2,3]}).toHTML();
Other samples
Dumper({ "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } }).toHTML()
Compatibility
Currently Supports: IE9+ and modern browsers