Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function pp(obj, indent) {
var v, key;
if (!indent) indent = '';
if (obj===undefined) return;
if (isHash(obj)) {
CORE.println('');
for(key in obj) {
if (!obj.hasOwnProperty(key)) continue;
v = obj[key];
CORE.print(indent+key+': ');
if (isHash(v) || isArray(v)) {
pp(v, indent+' ');
} else {
CORE.println(v);
}
}
} else if (isArray(obj)) {
if (obj.some(function(x) { return isHash(x) || isArray(x); })) {
obj.forEach(function(x) {
pp(x, indent+' ');
CORE.println('');
});
} else {
CORE.print(obj.join(', '));
}
} else {
v = obj[key];
CORE.print(indent+key+': ');
if (isHash(v) || isArray(v)) {
pp(v, indent+' ');
} else {
CORE.println(v);
}
}
} else if (isArray(obj)) {
if (obj.some(function(x) { return isHash(x) || isArray(x); })) {
obj.forEach(function(x) {
pp(x, indent+' ');
CORE.println('');
});
} else {
CORE.print(obj.join(', '));
}
} else {
CORE.println(indent+obj);
}
}