From 289786ac13c6f4b9c720278d0089c0a864656ea3 Mon Sep 17 00:00:00 2001 From: Calvin Metcalf Date: Sun, 13 Nov 2016 20:50:04 -0500 Subject: [PATCH] fix gulp weirdness --- build/files.js | 6 +++++- lib/_stream_writable.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build/files.js b/build/files.js index 955cc168d7..ede126a18a 100644 --- a/build/files.js +++ b/build/files.js @@ -179,7 +179,10 @@ const headRegexp = /(^module.exports = \w+;?)/m /require\('internal\/streams\/BufferList'\)/, 'require(\'./internal/streams/BufferList\')' ] - + , fixInstanceCheck = [ + /if \(typeof Symbol === 'function' && Symbol\.hasInstance\) \{/, + `if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {` + ] module.exports['_stream_duplex.js'] = [ requireReplacement @@ -257,6 +260,7 @@ module.exports['_stream_writable.js'] = [ , fixSyncWrite , bufferShimFix , bufferStaticMethods + , fixInstanceCheck ] module.exports['internal/streams/BufferList.js'] = [ bufferShimFix diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 290b5ee9fd..4d9c62ba62 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -177,7 +177,7 @@ WritableState.prototype.getBuffer = function getBuffer() { // Test _writableState for inheritance to account for Duplex streams, // whose prototype chain only points to Readable. var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance) { +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { realHasInstance = Function.prototype[Symbol.hasInstance]; Object.defineProperty(Writable, Symbol.hasInstance, { value: function (object) {