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.

18 lines
440 B
JavaScript

"use strict";
const Promise = require("bluebird");
const pipe = require("@promistream/pipe");
const rangeNumbers = require("@promistream/range-numbers");
const find = require("./");
const spy = require("@promistream/spy");
return Promise.try(() => {
return pipe([
rangeNumbers(5, 20),
spy((value) => console.log(`trying ${value}`)),
find((value) => value % 4 === 0)
]).read();
}).then((result) => {
console.log(result); // 8
});