Warn about attempting to push multiple values at once.

This commit is contained in:
David Braun 2017-10-08 15:35:50 -04:00
parent c56f4404f8
commit f2c26591a1
No known key found for this signature in database
GPG key ID: 5694EEC4D129BDCF
2 changed files with 24 additions and 9 deletions

View file

@ -232,6 +232,8 @@ const Channel = function (bufferLength = 0) {
order.reject(new TypeError(
`Can't push 'undefined' to channel, use close instead.`
))
} else if (arguments.length > 1) {
order.reject(new Error(`Can't push more than one value at a time.`))
} else {
pushes.push(order)
setImmediate(processOrders)