Revision fc0627cda4f3fafad3b8b212ce7912c53771e78e authored by Irakli Gozalishvili on 22 January 2013, 17:02:00 UTC, committed by Irakli Gozalishvili on 22 January 2013, 17:02:00 UTC
1 parent bac1edf
filter.js
"use strict";
var reducer = require("./reducer")
var filter = reducer(function filter(predicate, next, value, result) {
/**
Composes filtered version of given `source`, such that only items contained
will be once on which `f(item)` was `true`.
## Example
var digits = filter([ 10, 23, 2, 7, 17 ], function(value) {
return value >= 0 && value <= 9
})
print(digits) // => < 2 7 >
**/
return predicate(value) ? next(value, result) :
result
})
module.exports = filter
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...