pete/lib/runs/auto

(require("pete/lib/runs/auto"))(fn, options, state) → {module:pete/lib/runner~run}

Description:
  • Try to find a best way to run target function.
    If fn is a string, create and return a fork run.
    If it is an async function, or it runs and return a Promise or an object with a catch method, create and return an async run.
    If it can be parsed and last argument is named "cb", "callback", "done", or "next", create and return a callback run.
    Otherwise create and return a sync run.

Source:
Parameters:
Name Type Description
fn function
options object
state object
Returns:
Type
module:pete/lib/runner~run

Members

(static, constant) TYPES :function

Description:
  • Map of supported function runners.
    Every key is a "type name", every value is a factory function.

Source:
Properties:
Name Type Description
sync module:pete/lib/runs/sync
generator module:pete/lib/runs/generator
callback module:pete/lib/runs/callback
async module:pete/lib/runs/async
fork module:pete/lib/runs/fork
skip module:pete/lib/runs/skip
echo module:pete/lib/runs/echo

Map of supported function runners.
Every key is a "type name", every value is a factory function.

Type:
  • function