UNPKG

cooperative

Version:

cooperative threading versions of map, filter, forEach, etc, suitable for big processing in single-threaded Node.js

8 lines (6 loc) 242 B
var map = require('./map') module.exports = function filter(array, predicate, options) { return map(array, predicate, options).then(function(predicates) { return array.filter(function (item, index) { return predicates[index] }) }) }