refactor: drop usage of _.isFunction

This commit is contained in:
Justin Beckwith 2018-11-09 17:19:27 -08:00
parent 494b97ac1a
commit a58c178119
1 changed files with 6 additions and 6 deletions

View File

@ -449,7 +449,7 @@ Client.prototype.resolveCallInterceptors = function(method_definition, intercept
Client.prototype.makeUnaryRequest = function(path, serialize, deserialize, Client.prototype.makeUnaryRequest = function(path, serialize, deserialize,
argument, metadata, options, argument, metadata, options,
callback) { callback) {
if (_.isFunction(options)) { if (typeof options === 'function') {
callback = options; callback = options;
if (metadata instanceof Metadata) { if (metadata instanceof Metadata) {
options = {}; options = {};
@ -457,7 +457,7 @@ Client.prototype.makeUnaryRequest = function(path, serialize, deserialize,
options = metadata; options = metadata;
metadata = new Metadata(); metadata = new Metadata();
} }
} else if (_.isFunction(metadata)) { } else if (typeof metadata === 'function') {
callback = metadata; callback = metadata;
metadata = new Metadata(); metadata = new Metadata();
options = {}; options = {};
@ -470,7 +470,7 @@ Client.prototype.makeUnaryRequest = function(path, serialize, deserialize,
} }
if (!((metadata instanceof Metadata) && if (!((metadata instanceof Metadata) &&
(options instanceof Object) && (options instanceof Object) &&
(_.isFunction(callback)))) { (typeof callback === 'function'))) {
throw new Error('Argument mismatch in makeUnaryRequest'); throw new Error('Argument mismatch in makeUnaryRequest');
} }
@ -552,7 +552,7 @@ Client.prototype.makeUnaryRequest = function(path, serialize, deserialize,
Client.prototype.makeClientStreamRequest = function(path, serialize, Client.prototype.makeClientStreamRequest = function(path, serialize,
deserialize, metadata, deserialize, metadata,
options, callback) { options, callback) {
if (_.isFunction(options)) { if (typeof options === 'function') {
callback = options; callback = options;
if (metadata instanceof Metadata) { if (metadata instanceof Metadata) {
options = {}; options = {};
@ -560,7 +560,7 @@ Client.prototype.makeClientStreamRequest = function(path, serialize,
options = metadata; options = metadata;
metadata = new Metadata(); metadata = new Metadata();
} }
} else if (_.isFunction(metadata)) { } else if (typeof metadata === 'function') {
callback = metadata; callback = metadata;
metadata = new Metadata(); metadata = new Metadata();
options = {}; options = {};
@ -573,7 +573,7 @@ Client.prototype.makeClientStreamRequest = function(path, serialize,
} }
if (!((metadata instanceof Metadata) && if (!((metadata instanceof Metadata) &&
(options instanceof Object) && (options instanceof Object) &&
(_.isFunction(callback)))) { (typeof callback === 'function'))) {
throw new Error('Argument mismatch in makeClientStreamRequest'); throw new Error('Argument mismatch in makeClientStreamRequest');
} }