We can mix the two approaches by adding the minimal chain operator which then allows us to create a more fluent style but yet keeping the surface area to a minimum.

In [1]:
// CommonJS
const Iterable = require('ix/iterable').IterableX;
const of = require('ix/iterable/of').of;
const filter = require('ix/iterable/filter').filter;
const map = require('ix/iterable/map').map;

Out[1]:
{ chainProto: [Function: chainProto] }
In [2]:
const results = of(1,2,3)
.chain(source => filter(source, x => x % 2 === 0))
.chain(source => map(source, x => x * x));

for (let item of results) {
console.log(Next \${item})
}

Next 4