Method compareConditions documentation
Checks whether the given data object complies or not with the given filter.
Example
```javascript
let item = {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589};
bbn.fn.compareConditions(item, {
logic: "AND",
conditions: [
{
field: "director",
value: "Steven Spielberg"
}
]
});
// true
bbn.fn.compareConditions(item, bbn.fn.filterToConditions({director: "Steven Soderberg"}));
// false
bbn.fn.compareConditions(item, bbn.fn.filterToConditions({director: "Steven Spielberg"}));
// true
bbn.fn.compareConditions(item, bbn.fn.filterToConditions({year: 1980}, ">"));
// true
bbn.fn.compareConditions(item, {
logic: "AND",
conditions: [
{
field: "year",
operator: "<",
value: 1980
}
]
});
// false
```
Checks whether the given data object complies or not with the given filter. - The filter format must be full (i.e. with the properties logic and conditions) such as
seen in the function bbn.fn.search and can be generated by the function bbn.fn.filterToConditions.
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions