Skip to content

Commit

Permalink
Merge pull request #1786 from amje/fix-function-check
Browse files Browse the repository at this point in the history
fix(grpc-native-core): incomplete function check
  • Loading branch information
murgatroid99 committed May 14, 2021
2 parents ccaceae + b1c1f96 commit d85324d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/grpc-native-core/src/client_interceptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d85324d

Please sign in to comment.