Search code examples
javascriptecmascript-6lodash

How can I improve my filtered Loop of Objects with lodash?


I am looping through issues in the data filtered by a condition.

const rowObjects = Object.keys(data).filter((list) => {
  let issueRow = data[list];
  let destroyFilter = list._destroy:
    return !destroyFilter ? list : null;
}).
map((issue, key) => ({
  console.log(key + 1)

}));

I am wondering if there is a way todo this with lodash?


Solution

  • I would do something like this, I just learned actually.

    const filter = _.pickBy(data, (list) => {
     return //whatever you want 
      });