Effectively a fork of loopback-filters
Works according to Loopback Where Criteria spec. With the additional support for array predicates some and all.
const condition = {
lines: {
some: {
status: 'good',
},
},
};
const data = {
lines: [
{
status: 'good',
},
{
status: 'bad',
},
],
};
const result = whereFilter(condition)(data);
console.log(result);
// true
const condition = {
lines: {
all: {
status: 'good',
},
},
};
const data = {
lines: [
{
status: 'good',
},
{
status: 'good',
},
],
};
const result = whereFilter(condition)(data);
console.log(result);
// true