You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
314 B
14 lines
314 B
|
3 years ago
|
var safeCb = require('./safeCb');
|
||
|
|
var each = require('./each');
|
||
|
|
|
||
|
|
exports = function(obj, predicate, ctx) {
|
||
|
|
var ret = [];
|
||
|
|
predicate = safeCb(predicate, ctx);
|
||
|
|
each(obj, function(val, idx, list) {
|
||
|
|
if (predicate(val, idx, list)) ret.push(val);
|
||
|
|
});
|
||
|
|
return ret;
|
||
|
|
};
|
||
|
|
|
||
|
|
module.exports = exports;
|