difference
Return a query representing the values that are in one set that are not in the another set.
queryLogic.difference(a, b)
Returns a set that represents the difference of sets A and B. In set theory, a difference is
represented by A \ B
. The returned query would represent the values that are in one set that are not in the another set. Difference is sometimes known as relative complement in set theory.
import {QueryLogic} from "can";
const queryLogic = new QueryLogic();
const filter = queryLogic.difference(
{ filter: { name: {$in: ["Ramiya", "Bohdi"]} } },
{ filter: { name: "Bohdi" } }
);
console.log( filter ); //-> {filter: {name: "Ramiya"}}
// A is totally inside B
const emptyFilter = queryLogic.difference(
{ filter: { name: "Bohdi" } },
{}
);
console.log( emptyFilter ); //-> QueryLogic.EMPTY
Parameters
Returns
{Query}
:
Returns a query object, or one of the special sets:
- EMPTY - Query
a
is inside queryb
. - UNDEFINABLE - A difference exists, but it can not be represented with the current logic.
- UNKNOWABLE - The logic is unable to determine if a difference exists or not.