Ctor single arg: allow plain object, reject null/undefined

Thank you @kub1x
This commit is contained in:
Lovell Fuller
2017-05-06 19:03:14 +01:00
parent 39a21787b7
commit c41d755441
14 changed files with 104 additions and 79 deletions

View File

@@ -16,6 +16,9 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
} else if (is.buffer(input)) {
// Buffer
inputDescriptor.buffer = input;
} else if (is.plainObject(input) && !is.defined(inputOptions)) {
// Plain Object descriptor, e.g. create
inputOptions = input;
} else if (!is.defined(input) && is.object(containerOptions) && containerOptions.allowStream) {
// Stream
inputDescriptor.buffer = [];