mirror of https://github.com/grpc/grpc-node.git
refactor: use Array.isArray instead of _.isArray
This commit is contained in:
parent
f70eabb1ec
commit
50ead820a2
|
@ -371,7 +371,7 @@ function Client(address, credentials, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve interceptor options and assign interceptors to each method
|
// Resolve interceptor options and assign interceptors to each method
|
||||||
if (_.isArray(options.interceptor_providers) && _.isArray(options.interceptors)) {
|
if (Array.isArray(options.interceptor_providers) && Array.isArray(options.interceptors)) {
|
||||||
throw new client_interceptors.InterceptorConfigurationError(
|
throw new client_interceptors.InterceptorConfigurationError(
|
||||||
'Both interceptors and interceptor_providers were passed as options ' +
|
'Both interceptors and interceptor_providers were passed as options ' +
|
||||||
'to the client constructor. Only one of these is allowed.');
|
'to the client constructor. Only one of these is allowed.');
|
||||||
|
@ -409,12 +409,12 @@ function Client(address, credentials, options) {
|
||||||
exports.Client = Client;
|
exports.Client = Client;
|
||||||
|
|
||||||
Client.prototype.resolveCallInterceptors = function(method_definition, interceptors, interceptor_providers) {
|
Client.prototype.resolveCallInterceptors = function(method_definition, interceptors, interceptor_providers) {
|
||||||
if (_.isArray(interceptors) && _.isArray(interceptor_providers)) {
|
if (Array.isArray(interceptors) && Array.isArray(interceptor_providers)) {
|
||||||
throw new client_interceptors.InterceptorConfigurationError(
|
throw new client_interceptors.InterceptorConfigurationError(
|
||||||
'Both interceptors and interceptor_providers were passed as call ' +
|
'Both interceptors and interceptor_providers were passed as call ' +
|
||||||
'options. Only one of these is allowed.');
|
'options. Only one of these is allowed.');
|
||||||
}
|
}
|
||||||
if (_.isArray(interceptors) || _.isArray(interceptor_providers)) {
|
if (Array.isArray(interceptors) || Array.isArray(interceptor_providers)) {
|
||||||
interceptors = interceptors || [];
|
interceptors = interceptors || [];
|
||||||
interceptor_providers = interceptor_providers || [];
|
interceptor_providers = interceptor_providers || [];
|
||||||
return client_interceptors.resolveInterceptorProviders(interceptor_providers, method_definition).concat(interceptors);
|
return client_interceptors.resolveInterceptorProviders(interceptor_providers, method_definition).concat(interceptors);
|
||||||
|
|
|
@ -353,7 +353,7 @@ RequesterBuilder.prototype.build = function() {
|
||||||
* @return {null|Interceptor[]}
|
* @return {null|Interceptor[]}
|
||||||
*/
|
*/
|
||||||
var resolveInterceptorProviders = function(providers, method_definition) {
|
var resolveInterceptorProviders = function(providers, method_definition) {
|
||||||
if (!_.isArray(providers)) {
|
if (!Array.isArray(providers)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var interceptors = [];
|
var interceptors = [];
|
||||||
|
|
|
@ -167,5 +167,5 @@ exports.loadObject = function loadObject(value, options) {
|
||||||
* ReflectionObject
|
* ReflectionObject
|
||||||
*/
|
*/
|
||||||
exports.isProbablyProtobufJs5 = function isProbablyProtobufJs5(obj) {
|
exports.isProbablyProtobufJs5 = function isProbablyProtobufJs5(obj) {
|
||||||
return _.isArray(obj.children) && (typeof obj.build === 'function');
|
return Array.isArray(obj.children) && (typeof obj.build === 'function');
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,7 +39,7 @@ var CallRegistry = function(done, expectation, is_ordered, is_verbose) {
|
||||||
this.call_array = [];
|
this.call_array = [];
|
||||||
this.done = done;
|
this.done = done;
|
||||||
this.expectation = expectation;
|
this.expectation = expectation;
|
||||||
this.expectation_is_array = _.isArray(this.expectation);
|
this.expectation_is_array = Array.isArray(this.expectation);
|
||||||
this.is_ordered = is_ordered;
|
this.is_ordered = is_ordered;
|
||||||
this.is_verbose = is_verbose;
|
this.is_verbose = is_verbose;
|
||||||
if (is_verbose) {
|
if (is_verbose) {
|
||||||
|
|
Loading…
Reference in New Issue