You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
466 B
JavaScript
26 lines
466 B
JavaScript
"use strict";
|
|
|
|
const pipe = require("@promistream/pipe");
|
|
const fromIterable = require("@promistream/from-iterable");
|
|
const simpleSink = require(".");
|
|
|
|
(async () => {
|
|
let result = await pipe([
|
|
fromIterable([ 1, 2, 3, 4, 5 ]),
|
|
simpleSink(async (value, abort) => {
|
|
console.log("value seen:", value);
|
|
})
|
|
]).read();
|
|
|
|
console.log("result:", result);
|
|
})();
|
|
|
|
/* Output:
|
|
value seen: 1
|
|
value seen: 2
|
|
value seen: 3
|
|
value seen: 4
|
|
value seen: 5
|
|
result: undefined
|
|
*/
|