Skip to content

Commit

Permalink
Merge pull request #1759 from zereraz/grpc@1.24.x
Browse files Browse the repository at this point in the history
grpc: stricter function check than instanceof
  • Loading branch information
murgatroid99 committed Apr 20, 2021
2 parents 545a935 + b6181d9 commit a5f01fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/grpc-native-core/src/client_interceptors.js
Expand Up @@ -1335,15 +1335,15 @@ var listenerGenerators = {
* @return {grpc~Listener}
*/
function getLastListener(method_definition, emitter, callback) {
if (emitter instanceof Function) {
if (toString.call(emitter) === '[object Function]') {
callback = emitter;
callback = function() {};
}
if (!(callback instanceof Function)) {
if (!(toString.call(callback) === '[object Function]')) {
callback = function() {};
}
if (!((emitter instanceof EventEmitter) &&
(callback instanceof Function))) {
(toString.call(callback) === '[object Function]'))) {
throw new Error('Argument mismatch in getLastListener');
}
var method_type = common.getMethodType(method_definition);
Expand Down Expand Up @@ -1376,7 +1376,7 @@ function getInterceptingCall(method_definition, options,
* @return {Interceptor}
*/
function _getLastInterceptor(method_definition, channel, responder) {
var callback = (responder instanceof Function) ? responder : function() {};
var callback = (toString.call(responder) === '[object Function]') ? responder : function() {};
var emitter = (responder instanceof EventEmitter) ? responder :
new EventEmitter();
var method_type = common.getMethodType(method_definition);
Expand Down

0 comments on commit a5f01fb

Please sign in to comment.