(require("pete/lib/runs/auto"))(fn, options, state) → {module:pete/lib/runner~run}
- Description:
Try to find a best way to run target function.
Iffnis a string, create and return aforkrun.
If it is anasyncfunction, or it runs and return a Promise or an object with acatchmethod, create and return anasyncrun.
If it can be parsed and last argument is named "cb", "callback", "done", or "next", create and return acallbackrun.
Otherwise create and return asyncrun.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
fn |
function | |
options |
object | |
state |
object |
Returns:
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