ProceduralLambda

ProceduralLambda

A descriptor of a sequence of operations to be executed on a data source.

Constructor

new ProceduralLambda(sourceopt)

Source:

Methods descriptors:

Mutates state - changes the object's internal state

Immutable - does not change the internal state, instead returns a new object

Chainable - returns self, so chained calls are possible

Quick - Passed function bodies will be injected into procedural code. Lambdas passed to Quick methods MUST use the variable names v,i,s (all are optional; stands for value, index, self). Note that a Lambda does not use {}.

Slow - Passed functions will be called from the procedural code.

Parameters:
Name Type Attributes Description
source Collection <optional>

Attach to a data source. Can be defined later with execute.

Members

length

Source:

Return the result length. Provided for compatibility with Array interface.

Methods

compile()

Source:

Turn a pipeline of operations into procedural source code. Makes the next call to execute a bit faster. Mutates state.

execute(sourceopt) → {Array|*}

Source:

Execute the processing pipeline on a data source.

Parameters:
Name Type Attributes Description
source Collection <optional>

The data source to examine.

Returns:

The result of the pipeline, which is an array or a value if the pipeline uses reduce.

Type
Array | *

filter(lambda) → {ProceduralLambda}

Source:

Add a filtering step. Quick. Immutable. Chainable

Parameters:
Name Type Description
lambda function

The Lambda to inject.

Returns:

A new instance.

Type
ProceduralLambda

filterComplex(fn) → {ProceduralLambda}

Source:

Add a filtering step. Slow. Immutable. Chainable.

Parameters:
Name Type Description
fn function

The function to call.

Returns:

A new instance.

Type
ProceduralLambda

map(lambda) → {ProceduralLambda}

Source:

Add a map step.

Parameters:
Name Type Description
lambda function

The Lambda to inject.

Returns:

A new instance.

Type
ProceduralLambda

mapComplex(fn) → {ProceduralLambda}

Source:

Add a map step.

Parameters:
Name Type Description
fn function

The function to call.

Returns:

A new instance.

Type
ProceduralLambda

reduce(lambda, init) → {ProceduralLambda}

Source:

Add a reduce step.

Parameters:
Name Type Description
lambda function

The Lambda to inject.

init *

Initial accum value.

Returns:

A new instance.

Type
ProceduralLambda

reduceComplex(fn, init) → {ProceduralLambda}

Source:

Add a reduce step.

Parameters:
Name Type Description
fn function

The function to call.

init *

Initial accum value.

Returns:

A new instance.

Type
ProceduralLambda

takeUntil(lambda) → {ProceduralLambda}

Source:

Add a takeUntil step. When the passed lambda returns false no more rows are processed.

Parameters:
Name Type Description
lambda function

The Lambda to inject.

Returns:

A new instance.

Type
ProceduralLambda

takeUntilComplex(fn) → {ProceduralLambda}

Source:

Add a takeUntil step. When the passed function returns false no more rows are processed.

Parameters:
Name Type Description
fn function

The Function to call.

Returns:

A new instance.

Type
ProceduralLambda