From b1c1f964015b633acf1a5b5e59673fb9ae25c04a Mon Sep 17 00:00:00 2001 From: Andrey Morozov Date: Thu, 13 May 2021 18:37:37 +0300 Subject: [PATCH] fix(grpc-native-core): incomplete function check --- packages/grpc-native-core/src/client_interceptors.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/grpc-native-core/src/client_interceptors.js b/packages/grpc-native-core/src/client_interceptors.js index 766b412e2..35d1e7f84 100644 --- a/packages/grpc-native-core/src/client_interceptors.js +++ b/packages/grpc-native-core/src/client_interceptors.js @@ -1335,15 +1335,15 @@ var listenerGenerators = { * @return {grpc~Listener} */ function getLastListener(method_definition, emitter, callback) { - if (toString.call(emitter) === '[object Function]') { + if (typeof emitter === 'function') { callback = emitter; callback = function() {}; } - if (!(toString.call(callback) === '[object Function]')) { + if (typeof callback !== 'function') { callback = function() {}; } if (!((emitter instanceof EventEmitter) && - (toString.call(callback) === '[object Function]'))) { + (typeof callback === 'function'))) { throw new Error('Argument mismatch in getLastListener'); } var method_type = common.getMethodType(method_definition); @@ -1376,7 +1376,7 @@ function getInterceptingCall(method_definition, options, * @return {Interceptor} */ function _getLastInterceptor(method_definition, channel, responder) { - var callback = (toString.call(responder) === '[object Function]') ? responder : function() {}; + var callback = typeof responder === 'function' ? responder : function() {}; var emitter = (responder instanceof EventEmitter) ? responder : new EventEmitter(); var method_type = common.getMethodType(method_definition);