Use spread syntax instead of function apply

This commit is contained in:
Kevin Sawicki 2016-12-01 14:37:03 -08:00
parent f72942bff1
commit c8ff67ab75
12 changed files with 30 additions and 34 deletions

View file

@ -83,20 +83,20 @@ class IncomingMessage extends Readable {
URLRequest.prototype._emitRequestEvent = function (isAsync, ...rest) {
if (isAsync) {
process.nextTick(() => {
this.clientRequest.emit.apply(this.clientRequest, rest)
this.clientRequest.emit(...rest)
})
} else {
this.clientRequest.emit.apply(this.clientRequest, rest)
this.clientRequest.emit(...rest)
}
}
URLRequest.prototype._emitResponseEvent = function (isAsync, ...rest) {
if (isAsync) {
process.nextTick(() => {
this._response.emit.apply(this._response, rest)
this._response.emit(...rest)
})
} else {
this._response.emit.apply(this._response, rest)
this._response.emit(...rest)
}
}