Methods whose signature is (value [, number]) cannot be used directly as array iterators whose 2nd argument is the array index. It'd be useful add guard params that allow the following examples to work with standard array methods:
array.filter(verge.inViewport)
array.some(verge.inViewport)
array.map(verge.rectangle)
We can achieve this similar to how underscore uses guard params. For example:
function rectangle(el, pad, guard) {
pad = !guard && +pad || 0; // number and not NaN
We had some partial undocumented support for this in some versions. We should add it to all applicable methods with this signature and document the usage.
Methods whose signature is
(value [, number])cannot be used directly as array iterators whose 2nd argument is the array index. It'd be useful addguardparams that allow the following examples to work with standard array methods:We can achieve this similar to how underscore uses
guardparams. For example:We had some partial undocumented support for this in some versions. We should add it to all applicable methods with this signature and document the usage.