Hacker News new | ask | show | jobs
by adgasf 2326 days 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);