Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/internal/webstreams/adapters.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const {

const {
validateBoolean,
validateFunction,
validateObject,
} = require('internal/validators');

Expand Down Expand Up @@ -924,8 +925,7 @@ function newReadableStreamFromStreamBase(streamBase, strategy, options = kEmptyO
if (typeof streamBase.onread === 'function')
throw new ERR_INVALID_STATE('StreamBase already has a consumer');

if (typeof ondone !== 'function')
throw new ERR_INVALID_ARG_TYPE('options.ondone', 'Function', ondone);
validateFunction(ondone, 'options.ondone');

let controller;

Expand Down
8 changes: 5 additions & 3 deletions lib/internal/webstreams/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const {

const {
codes: {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_OPERATION_FAILED,
},
Expand Down Expand Up @@ -48,6 +47,10 @@ const {
const assert = require('internal/assert');
const { isArrayBufferDetached } = require('internal/util');

const {
validateFunction,
} = require('internal/validators');

const kState = Symbol('kState');
const kType = Symbol('kType');

Expand Down Expand Up @@ -78,8 +81,7 @@ function extractHighWaterMark(value, defaultHWM) {

function extractSizeAlgorithm(size) {
if (size === undefined) return () => 1;
if (typeof size !== 'function')
throw new ERR_INVALID_ARG_TYPE('strategy.size', 'Function', size);
validateFunction(size, 'strategy.size');
return size;
}

Expand Down