blob: 62932a0e2b7926ed4d8ddb37595d2b0a0c84b959 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
'use strict';
import arrayMap from 'lodash-es/_arrayMap';
import property from 'lodash-es/_baseProperty';
export default function _filter(eachfn, arr, iterator, callback) {
var results = [];
eachfn(arr, function (x, index, callback) {
iterator(x, function (v) {
if (v) {
results.push({index: index, value: x});
}
callback();
});
}, function () {
callback(arrayMap(results.sort(function (a, b) {
return a.index - b.index;
}), property('value')));
});
}
|