UNPKG

@extra-array/scan-while-right

Version:

Scans from right, while a test passes.

9 lines (8 loc) 192 B
'use strict'; function scanWhileRight(x, ft) { for (var i = x.length - 1; i >= 0; i--) if (!ft(x[i], i, x)) break; return i + 1; } module.exports = scanWhileRight;