lib/log/stringify.js
/**
 * Turn any JS value into a proper formated string for log
 *
 * @param {any} val The value to stringify
 * @param {boolean} compact Indicate if the value must be format as a single short line
 * @returns {string}
 */
Turn any JS value into a proper formated string for log
@param {any} val The value to stringify
@param {boolean} compact Indicate if the value must be format as a single short line
@returns {string}
Turn any JS value into a proper formated string for log @param { any } val The value to stringify @param { boolean } compact Indicate if the value must be format as a single short line @returns { string }
function stringify (val, compact) {
  const type = getType(val)
  const [title, detail] = format[type](val)
  if (type === `string`) {
    return title
  }
  if (compact) {
    detail.length = 0
  }
  return [
    `${compact ? `` : bold(`• `)}${title}`,
    ...detail.map(s => `${bold(`| `)}${s}`)
  ].join(compact ? ` ` : `\n`)
}
function stringify ( val , compact ) { const type = getType ( val ) const [ title , detail ] = format [ type ] ( val ) if ( type === ` ` ) { return title } if ( compact ) { detail . length = 0 } return [ ` ${ compact ? ` ` : bold ( ` } $ { ti tle}` , ... detail . map ( s => ` ${ bold ( ` ` ) } ${ s } ` ) ] . join ( compact ? ` ` : ` \n ` ) }
Turn any JS value into a proper formated string for log
 @param {any} val The value to stringify
 @param {boolean} compact Indicate if the value must be format as a single short line
 @returns {string}
Turn any JS value into a proper formated string for log @param { any } val The value to stringify @param { boolean } compact Indicate if the value must be format as a single short line @returns { string }