|
|
@ -12,7 +12,7 @@ const isFunction = require("@validatem/is-function");
|
|
|
|
const defaultTo = require("@validatem/default-to");
|
|
|
|
const defaultTo = require("@validatem/default-to");
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Update other stream implementations to new API
|
|
|
|
// FIXME: Update other stream implementations to new API
|
|
|
|
module.exports = function greedySinkStream(_options) {
|
|
|
|
module.exports = function simpleSinkStream(_options) {
|
|
|
|
let { onResult, onEnd, onAbort } = validateOptions(arguments, {
|
|
|
|
let { onResult, onEnd, onAbort } = validateOptions(arguments, {
|
|
|
|
onResult: [ required, isFunction ],
|
|
|
|
onResult: [ required, isFunction ],
|
|
|
|
onEnd: [ isFunction, defaultTo.literal(defaultOnEnd) ],
|
|
|
|
onEnd: [ isFunction, defaultTo.literal(defaultOnEnd) ],
|
|
|
@ -34,10 +34,10 @@ module.exports = function greedySinkStream(_options) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
description: `greedy sink stream`,
|
|
|
|
description: `simple sink stream`,
|
|
|
|
abort: propagateAbort,
|
|
|
|
abort: propagateAbort,
|
|
|
|
peek: propagatePeek,
|
|
|
|
peek: propagatePeek,
|
|
|
|
read: function produceValue_greedySinkStream(source) {
|
|
|
|
read: function produceValue_simpleSinkStream(source) {
|
|
|
|
function attemptRead() {
|
|
|
|
function attemptRead() {
|
|
|
|
return Promise.try(() => {
|
|
|
|
return Promise.try(() => {
|
|
|
|
return source.read();
|
|
|
|
return source.read();
|
|
|
|