@@ -110,7 +110,7 @@ module.exports = class Interceptor {
110110
111111 reply ( statusCode , body , rawHeaders ) {
112112 // support the format of only passing in a callback
113- if ( statusCode instanceof Function ) {
113+ if ( typeof statusCode === 'function' ) {
114114 if ( arguments . length > 1 ) {
115115 // It's not very Javascript-y to throw an error for extra args to a function, but because
116116 // of legacy behavior, this error was added to reduce confusion for those migrating.
@@ -126,7 +126,7 @@ module.exports = class Interceptor {
126126 }
127127
128128 this . statusCode = statusCode || 200
129- if ( body instanceof Function ) {
129+ if ( typeof body === 'function' ) {
130130 this . replyFunction = body
131131 body = null
132132 }
@@ -215,7 +215,7 @@ module.exports = class Interceptor {
215215 }
216216
217217 if ( reqHeader !== undefined && header !== undefined ) {
218- if ( reqHeader instanceof Function ) {
218+ if ( typeof reqHeader === 'function' ) {
219219 return reqHeader ( header )
220220 } else if ( common . matchStringOrRegexp ( header , reqHeader ) ) {
221221 return true
@@ -250,7 +250,7 @@ module.exports = class Interceptor {
250250
251251 const requestMatchesFilter = ( { name, value : predicate } ) => {
252252 const headerValue = req . getHeader ( name )
253- if ( predicate instanceof Function ) {
253+ if ( typeof predicate === 'function' ) {
254254 return predicate ( headerValue )
255255 } else {
256256 return common . matchStringOrRegexp ( headerValue , predicate )
@@ -317,7 +317,7 @@ module.exports = class Interceptor {
317317 matchKey = common . normalizeOrigin ( proto , options . host , options . port )
318318 }
319319
320- if ( this . uri instanceof Function ) {
320+ if ( typeof this . uri === 'function' ) {
321321 matches =
322322 common . matchStringOrRegexp ( matchKey , this . basePath ) &&
323323 // This is a false positive, as `uri` is not bound to `this`.
@@ -397,7 +397,7 @@ module.exports = class Interceptor {
397397 debug ( 'Interceptor queries: %j' , this . queries )
398398 debug ( ' Request queries: %j' , reqQueries )
399399
400- if ( this . queries instanceof Function ) {
400+ if ( typeof this . queries === 'function' ) {
401401 return this . queries ( reqQueries )
402402 }
403403
@@ -458,7 +458,7 @@ module.exports = class Interceptor {
458458 return this
459459 }
460460
461- if ( queries instanceof Function ) {
461+ if ( typeof queries === 'function' ) {
462462 this . queries = queries
463463 return this
464464 }
0 commit comments