Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function pp(object){
- switch ($type(object)){
- case 'object':
- object = $H(object);
- var h = '{ ';
- object.each(function(value, key){
- h += '{key}: {value}, '.substitute({key:key, value: pp(value) })
- })
- h += ' }'
- // var h = '<table>';
- // object.each(function(value, key){
- // h += '<tr><th> {key} </th><td> {value} </td></tr>'.substitute({key:key, value: pp(value) })
- // })
- // h += '</table>'
- return h
- break;
- case 'array':
- object = $A(object);
- var h = '[';
- object.each(function(value, key){
- h += '{value}, '.substitute({value: pp(value) })
- })
- h += ']';
- return h
- break;
- case false: return 'false'; break;
- case 'string':
- case 'number':
- case 'boolean':
- case 'date':
- default: return object.toString();
- }
- };
Add Comment
Please, Sign In to add comment