import _ from 'lodash'; import logger from './logger'; function inspectObject (args) { function getValueArray (obj, indent = ' ') { if (!_.isObject(obj)) { return [obj]; } let strArr = ['{']; for (let [arg, value] of _.toPairs(obj)) { if (!_.isObject(value)) { strArr.push(`${indent} ${arg}: ${value}`); } else { value = getValueArray(value, `${indent} `); strArr.push(`${indent} ${arg}: ${value.shift()}`); strArr.push(...value); } } strArr.push(`${indent}}`); return strArr; } for (let [arg, value] of _.toPairs(args)) { value = getValueArray(value); logger.info(` ${arg}: ${value.shift()}`); for (let val of value) { logger.info(val); } } } export { inspectObject };