Hard
You're building a data processing pipeline using generators. What's the correct implementation to make this compose function work?
1function* filterGen(predicate, iterator) {2 for (const value of iterator) {3 if (predicate(value)) {4 yield value;5 }6 }7}89function* mapGen(transform, iterator) {10 for (const value of iterator) {11 yield transform(value);12 }13}1415// Missing implementation16____________________17____________________18____________________19____________________2021// Usage:22const pipeline = compose([23 iter => filterGen(x => x > 0, iter),24 iter => mapGen(x => x * 2, iter),25 iter => filterGen(x => x < 10, iter)26]);2728const numbers = [1, -2, 3, -4, 5, 6];29const result = [...pipeline(numbers)];30// Should output: [2, 6]