@6river/where-filter 中文文档教程
where-filter
https://loopback.io/doc/en
根据 Loopback Where Criteria 规范。 随着对数组谓词部分和全部的额外支持。
some
const condition = {
lines: {
some: {
status: 'good',
}
}
};
const data = {
lines: [
{
status: 'good',
},
{
status: 'bad',
}
]
};
const result = whereFilter(condition)(data);
console.log(result);
// true
all
const condition = {
lines: {
all: {
status: 'good',
}
}
};
const data = {
lines: [
{
status: 'good',
},
{
status: 'good',
}
]
};
const result = whereFilter(condition)(data);
console.log(result);
// true
where-filter
Effectively a fork of loopback-filters
Works according to Loopback Where Criteria spec. With the additional support for array predicates some and all.
some
const condition = {
lines: {
some: {
status: 'good',
}
}
};
const data = {
lines: [
{
status: 'good',
},
{
status: 'bad',
}
]
};
const result = whereFilter(condition)(data);
console.log(result);
// true
all
const condition = {
lines: {
all: {
status: 'good',
}
}
};
const data = {
lines: [
{
status: 'good',
},
{
status: 'good',
}
]
};
const result = whereFilter(condition)(data);
console.log(result);
// true