Skip to content
This repository

Synopsis

myArray.filter(elementalFunction, arg1, arg2, ...)

Arguments

Elemental function described below

arg1, arg2, ... passed unchanged to elemental function

Elemental Function

function (index, arg1, arg2, ...)

this The ParallelArray

index The location in “this” where the source element is found.

arg1, arg2, ... Same as the optional arguments passed to filter

Result

  • true (true, 1, or other JavaScript truthy value) if the source element should be placed in filter’s result.

  • false (false, 0, undefined, or other JavaScript falsey value) if the source element should not to be placed in filter’s result.

Returns

A freshly minted ParallelArray holding source elements where the results of applying the elemental function is true. The order of the elements in the returned ParallelArray is the same as the order of the elements in the source ParallelArray.

Examples

 // an identity function
 pa.filter(function(){return true;})
 // filter out values that are not even
 var source = new ParallelArray([1,2,3,4,5]);
 var even = source.filter(function even(iv) { return (this.get(iv) % 2) == 0; }); // <2,4>
Something went wrong with that request. Please try again.