Pipeline(name) → {Pipeline}

A structure for bulding and reconfiguring algorithms. This is meant to accelerate experimentation by creating re-usable and reconfigurable chunks of code. When an algorithm is finalized this can be optimized out by replacing the Pipeline with a suitable function that performs the same algorithm.

new Pipeline(name) → {Pipeline}

constructor

Parameters:
Name Type Description
name string

The name of the Pipeline

Returns:
Pipeline -

The Pipeline that was created

Methods

static build(desc) → {PipelineStage}

Builds a pipeline based on a description of the pipeline. The pipeline is an Array of pipeline stage objects.

Parameters:
Name Type Description
desc Array.<(string|Object)>

The description of the pipeline. See the test file pipeline.js for examples

Returns:
PipelineStage -

The first stage of the built pipeline.

static create(name, desc) → {Pipeline}

Creates a new pipleine named name built to the description desc

Parameters:
Name Type Description
name string

The name of the pipeline, for future reference

desc Array.<(string|Object)>

The pipeline description passed to build

Returns:
Pipeline -

The newly created Pipeline

static get(name) → {Pipeline}

Retrieves a pipeline with the matching name

Parameters:
Name Type Description
name string

Name of the pipeline to return

Returns:
Pipeline -

The matching Pipeline or undefined if no matching Pipeline is found

build(desc)

Builds the pipeline from a description and assigns it to the first stage of this pipeline. Pipeline building is done using the static build method.

Parameters:
Name Type Description
desc Array.<string>

An array of pipeline stage names or objects describing each stage.

async run(input) → {Promise.<any>}

Execute the pipeline

Parameters:
Name Type Description
input any

Input data value for the first stage of the pipeline

Returns:
Promise.<any> -

A Promise that resolves to the value of the pipeline, or rejects on error