19 ms·
The pipeline operator and some free functions is a superior alternative. const map = f => xs => ({ [Symbol.iterator]: function * () { for (co
by adgasf 7y ago
The pipeline operator and some free functions is a superior alternative.
const map = f => xs => ({
[Symbol.iterator]: function * () {
for (const x of xs) {
yield f(x);
}
}
});
xs |> map(x => x * 2);