@jswork/next-group-search

1.0.5 • Public • Published

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.

/@jswork/next-group-search/

    Package Sidebar

    Install

    npm i @jswork/next-group-search

    Homepage

    js.work

    Weekly Downloads

    6

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    9.77 kB

    Total Files

    6

    Last publish

    Collaborators

    • afeiship
    • yujiao.luo