"use strict"; const Promise = require("bluebird"); const simpleSink = require("@promistream/simple-sink"); module.exports = function find(predicate) { // FIXME: Validatem return simpleSink({ onResult: (value, abort) => { return Promise.try(() => { return predicate(value); }).then((result) => { if (result === true) { abort(true); return value; } }); } }); };