Skip to main content

Home > @jsplumbtoolkit/core > JsPlumbToolkit > filter

JsPlumbToolkit.filter() method

Filter the dataset and return a Selection containing matches. You can optionally provide a type parameter to indicate the type of objects you expect back in the Selection.

Signature:

filter<T = any>(spec: (o: Base) => boolean | ObjectData, includePartials?: boolean): Selection<T>;

Parameters

ParameterTypeDescription
spec(o: Base) => boolean | ObjectDataEither a function which is passed every object in the dataset and expected to return true to indicate inclusion, or an object containg key:value pairs to match in the backing data of each object in the dataset
includePartialsbooleanIf true, objects whose data matches one or more, but not all, of the pairs in spec will be included in the result. By default objects have to match all the pairs in spec to be included in the result.

Returns:

Selection<T>