Lines Matching refs:flatMap
17 // flatMap works on synchronous streams with a synchronous mapper
20 await oneTo5().flatMap((x) => [x + x]).toArray(),
24 await oneTo5().flatMap(() => []).toArray(),
28 await oneTo5().flatMap((x) => [x, x]).toArray(),
36 // flatMap works on sync/async streams with an asynchronous mapper
39 await oneTo5().flatMap(async (x) => [x, x]).toArray(),
44 await asyncOneTo5.flatMap(async (x) => [x, x]).toArray(),
50 // flatMap works on a stream where mapping returns a stream
52 const result = await oneTo5().flatMap(async (x) => {
57 // flatMap works on an objectMode stream where mappign returns a stream
59 const result = await oneTo5().flatMap(() => {
76 const stream = oneTo5().flatMap(common.mustNotCall(async (_, { signal }) => {
96 const stream = oneTo5().flatMap(common.mustNotCall(async (_, { signal }) => {
112 assert.throws(() => Readable.from([1]).flatMap(1), /ERR_INVALID_ARG_TYPE/);
113 assert.throws(() => Readable.from([1]).flatMap((x) => x, {
116 assert.throws(() => Readable.from([1]).flatMap((x) => x, 1), /ERR_INVALID_ARG_TYPE/);
117 assert.throws(() => Readable.from([1]).flatMap((x) => x, { signal: true }), /ERR_INVALID_ARG_TYPE/);
121 const stream = oneTo5().flatMap((x) => x);
130 stream.flatMap(() => true);