Algebra
Perform set logic with an awareness of how certain properties represent a set.
    new set.Algebra(compares...)
  
  An algebra instance can perform a variety of set logic methods
using the compares configuration.
A default algebra instance can be created like:
import set from "can-set-legacy";
const defaultAlgebra = new set.Algebra();
This treats every property as a filter in a where clause.  For example:
// `{id: 2, ownerId: 5}` belongs to ``.getList({ownerId: 5})`
defaultAlgebra.has( { ownerId: 5 }, { id: 2, ownerId: 5 } ); //-> true
defaultAlgebra.getSubset( { ownerId: 5 }, {},
    [
        { id: 1, ownerId: 2 },
        { id: 2, ownerId: 5 },
        { id: 3, ownerId: 12 }
    ] ); //-> [{id: 2, ownerId: 5}]
Compares configurations can be passed to add better property behavior awareness:
import set from "can-set-legacy";
const todoAlgebra = new set.Algebra(
    set.props.boolean( "completed" ),
    set.props.id( "_id" ),
    set.props.offsetLimit( "offset", "limit" )
);
defaultAlgebra.getSubset( { limit: 2, offset: 1 }, {},
    [
        { id: 1, ownerId: 2 },
        { id: 2, ownerId: 5 },
        { id: 3, ownerId: 12 }
    ] ); //-> [{id: 2, ownerId: 5},{id: 3, ownerId: 12}]
props has helper functions that make common Compares configurations.
 GitHub
GitHub Twitter
Twitter