@jswork/next-group-search
v1.0.5
Published
Group search for next.
Downloads
73
Readme
next-group-search
Group search for next.
installation
yarn add @jswork/next-group-search
usage
import '@jswork/next-group-search';
const g1 = {
restock: [
{ name: "asparagus", type: "vegetables", quantity: 5 },
{ name: "bananas", type: "fruit", quantity: 0 },
{ name: "cherries", type: "fruit", quantity: 5 }
],
ok: [
{ name: "goat", type: "meat", quantity: 23 },
{ name: "fish", type: "meat", quantity: 22 }
]
};
const res = nx.groupSearch(g1, {
filters: {
type: "fruit",
quantity: 5
},
callback: ({ item }) => {
return item.quantity > 0;
}
});
console.log(res);
// output:
// {
// restock: [
// { name: "asparagus", type: "vegetables", quantity: 5 },
// { name: "cherries", type: "fruit", quantity: 5 }
// ],
// ok: []
// };
license
Code released under the MIT license.