Open
Description
const L = {};
// map
L.map = function* map(collection, mapper) {
for(const c of collection) {
yield mapper(c);
}
}
// filter
L.filter = function* filter(collection, predicate) {
for(const c of collection) {
if (predicate(c)) yield c;
}
}
// index도 사용 가능..
function* map1 (col, mapper) {
let i = 0;
for(const c of col) {
yield mapper(c, i++);
}
}
Metadata
Metadata
Assignees
Labels
No labels