Closed GuillaumeRochat closed 4 years ago
// @Arnovsky
@GuillaumeRochat
However, I think the array method could check for if (is.function_(assertion)) instead of just if (assertion)
This would break if you have an array of functions.
@gioragutt no, it would only check for the assertion callback, making sure it is one, unless there's something else I didn't understand.
With the
is.array
changes to include an additional type check, theis.array
function can no longer be used within ais.all
. The behavior can also be misleading at first because it works when there is only one element being checked. It may be difficult to debug when used with the spread operator.E.g.:
I can easily change the syntax to
and have it work like it used to, with the added benefit of using it with the new type check when needed
However, I think the
array
method could check forif (is.function_(assertion))
instead of justif (assertion)
, this way it would not try to call the index number as a function (which Array.prototype.every sets as the second argument on its callback).