unicorn/prefer-array-some Pedantic
What it does
Prefers using Array#some
over Array#find()
, Array#findLast()
and a non-zero length check on the result of Array#filter()
Why is this bad?
Using .some()
is more idiomatic and easier to read.
Example
Examples of incorrect code for this rule:
javascript
const foo = array.find(fn) ? bar : baz;
Examples of correct code for this rule:
javascript
const foo = array.some(fn) ? bar : baz;