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.
32 lines
544 B
JavaScript
32 lines
544 B
JavaScript
"use strict";
|
|
|
|
const Promise = require("bluebird");
|
|
const fromLazyValue = require("./");
|
|
const pipe = require("@promistream/pipe");
|
|
const collect = require("@promistream/collect");
|
|
|
|
return Promise.try(() => {
|
|
console.log("Creating stream");
|
|
|
|
let lazyValueSource = fromLazyValue(() => {
|
|
console.log("Creating lazy value");
|
|
return 42;
|
|
});
|
|
|
|
console.log("Piping");
|
|
|
|
return pipe([
|
|
lazyValueSource,
|
|
collect()
|
|
]).read();
|
|
}).then((result) => {
|
|
console.log(result);
|
|
|
|
/*
|
|
Creating stream
|
|
Piping
|
|
Creating lazy value
|
|
[ 42 ]
|
|
*/
|
|
});
|