lib/Prompt.js
function(input, callback) {
  // Handle non-function `input`.
  if (!_.isFunction(input)) {
    callback(null, input)
    return
  }

  // Handle asynchronous `input` function.
  if (input.length) {
    input(callback)
    return
  }

  // Handle synchronous `input` function.
  var results = null
  var err = null
  try {
    results = input()
  } catch (e) {
    err = e
  }

  callback(err, results)
}
function(input, callback) {
  // Handle non-function `input`.
  if (!_.isFunction(input)) {
    callback(null, input)
    return
  }

  // Handle asynchronous `input` function.
  if (input.length) {
    input(callback)
    return
  }

  // Handle synchronous `input` function.
  var results = null
  var err = null
  try {
    results = input()
  } catch (e) {
    err = e
  }

  callback(err, results)
}
function ( input , callback ) { // Handle non-function `input`. if ( ! _ . isFunction ( input ) ) { callback ( null , input ) return } // Handle asynchronous `input` function. if ( input . length ) { input ( callback ) return } // Handle synchronous `input` function. var results = null var err = null try { results = input ( ) } catch ( e ) { err = e } callback ( err , results ) }
Allows any input to be treated asynchronously.
Allows any input to be treated asynchronously .