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
Parameter | Type | Description |
---|---|---|
spec | (o: Base) => boolean | ObjectData | Either 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 |
includePartials | boolean | If 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>