vue-hackernews-2.0 icon indicating copy to clipboard operation
vue-hackernews-2.0 copied to clipboard

what is the purposes of using filter(_ => _)?

Open gknpezgssb opened this issue 6 years ago • 1 comments

in src/entry-clint.js line 47

...
const asyncDataHooks = activated.map(c => c.asyncData).filter(_ => _)
...

in src/store/getters.js line 20

...
activeItems (state, getters) {
    return getters.activeIds.map(id => state.items[id]).filter(_ => _)
  }
...

what is the purposes of using filter(_ => _)? just get a new array?

gknpezgssb avatar Sep 19 '18 14:09 gknpezgssb

it filters out "empty" items (anything that's falsy).

LinusBorg avatar Sep 19 '18 15:09 LinusBorg