1.0.5 • Published 10 months ago

@jswork/next-group-search v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
10 months ago

next-group-search

Group search for next.

version license size download

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.

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

12 months ago

1.0.1

12 months ago