pdp === PHP Dump Parser
Node.js parser of PHP var dumps.
Install
npm install pdp
Usage (or what is a PHP dump?)
Given a variable, the PHP function print_r will print human-readable information about the variable. This is best illustrated with an example:
The above example will output:
Array( [a] => apple [b] => banana [c] => Array ( [0] => x [1] => y [2] => z ))
Feed the above output inside the <pre>
tags to this module and you get
a nice JavaScript object literal or Array:
var pdp = ;var dump = '...'; // let's imagine we have the entire Array(...) dump hereconsole; // prints: { a: 'apple', b: 'banana', c: [ 'x', 'y', 'z' ] }
License
MIT