Skip to content

Commit 289786a

Browse files
committed
fix gulp weirdness
1 parent 8f97e1d commit 289786a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

build/files.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ const headRegexp = /(^module.exports = \w+;?)/m
179179
/require\('internal\/streams\/BufferList'\)/,
180180
'require(\'./internal/streams/BufferList\')'
181181
]
182-
182+
, fixInstanceCheck = [
183+
/if \(typeof Symbol === 'function' && Symbol\.hasInstance\) \{/,
184+
`if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {`
185+
]
183186

184187
module.exports['_stream_duplex.js'] = [
185188
requireReplacement
@@ -257,6 +260,7 @@ module.exports['_stream_writable.js'] = [
257260
, fixSyncWrite
258261
, bufferShimFix
259262
, bufferStaticMethods
263+
, fixInstanceCheck
260264
]
261265
module.exports['internal/streams/BufferList.js'] = [
262266
bufferShimFix

lib/_stream_writable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ WritableState.prototype.getBuffer = function getBuffer() {
177177
// Test _writableState for inheritance to account for Duplex streams,
178178
// whose prototype chain only points to Readable.
179179
var realHasInstance;
180-
if (typeof Symbol === 'function' && Symbol.hasInstance) {
180+
if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
181181
realHasInstance = Function.prototype[Symbol.hasInstance];
182182
Object.defineProperty(Writable, Symbol.hasInstance, {
183183
value: function (object) {

0 commit comments

Comments
 (0)