{"size": 829, "ext": "js", "max_stars_repo_path": "x/trace.js", "max_stars_repo_name": "LMulvey/rubico", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "x/trace.js", "max_issues_repo_name": "LMulvey/rubico", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "x/trace.js", "max_forks_repo_name": "LMulvey/rubico", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.2195121951, "max_line_length": 107, "alphanum_fraction": 0.5922798552}
const funcConcat = require('../_internal/funcConcat')
const tapSync = require('../_internal/tapSync')

// ...any => ()
const tapLog = tapSync(console.log)

/**
 * @name trace
 *
 * @synopsis
 * ```coffeescript [specscript]
 * var args ...any,
 *   resolved any,
 *   resolver ...args=>resolved
 *
 * trace(...args) -> args[0]
 *
 * trace(resolver)(...args) -> resolved
 * ```
 *
 * @description
 * Log a value out to the console, returning the value. If the value is a function, treat it as a resolver.
 *
 * ```javascript [node]
 * pipe([
 *   trace,
 *   trace(value => value.toUpperCase()),
 * ])('hey') // hey
 *           // HEY
 * ```
 */
const trace = function (...args) {
  const arg0 = args[0]
  if (typeof arg0 == 'function') {
    return funcConcat(arg0, tapLog)
  }
  return tapLog(...args)
}

module.exports = trace
