UNPKG

@extra-array/filter-update

Version:

Keeps values which pass a test.

10 lines (9 loc) 208 B
'use strict'; function filter$(x, ft) { for (var i = 0, j = 0, I = x.length; i < I; i++) if (ft(x[i], i, x)) x[j++] = x[i]; x.length = j; return x; } module.exports = filter$;