From 50ead820a202df8594f868d24851c7629601335c Mon Sep 17 00:00:00 2001 From: Justin Beckwith Date: Mon, 12 Nov 2018 20:47:12 -0800 Subject: [PATCH] refactor: use Array.isArray instead of _.isArray --- packages/grpc-native-core/src/client.js | 6 +++--- packages/grpc-native-core/src/client_interceptors.js | 2 +- packages/grpc-native-core/src/protobuf_js_5_common.js | 2 +- packages/grpc-native-core/test/client_interceptors_test.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/grpc-native-core/src/client.js b/packages/grpc-native-core/src/client.js index 5a7086f3..d82848cd 100644 --- a/packages/grpc-native-core/src/client.js +++ b/packages/grpc-native-core/src/client.js @@ -371,7 +371,7 @@ function Client(address, credentials, options) { } // 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( 'Both interceptors and interceptor_providers were passed as options ' + 'to the client constructor. Only one of these is allowed.'); @@ -409,12 +409,12 @@ function Client(address, credentials, options) { exports.Client = Client; 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( 'Both interceptors and interceptor_providers were passed as call ' + 'options. Only one of these is allowed.'); } - if (_.isArray(interceptors) || _.isArray(interceptor_providers)) { + if (Array.isArray(interceptors) || Array.isArray(interceptor_providers)) { interceptors = interceptors || []; interceptor_providers = interceptor_providers || []; return client_interceptors.resolveInterceptorProviders(interceptor_providers, method_definition).concat(interceptors); diff --git a/packages/grpc-native-core/src/client_interceptors.js b/packages/grpc-native-core/src/client_interceptors.js index 5ef89a5d..d75026ca 100644 --- a/packages/grpc-native-core/src/client_interceptors.js +++ b/packages/grpc-native-core/src/client_interceptors.js @@ -353,7 +353,7 @@ RequesterBuilder.prototype.build = function() { * @return {null|Interceptor[]} */ var resolveInterceptorProviders = function(providers, method_definition) { - if (!_.isArray(providers)) { + if (!Array.isArray(providers)) { return null; } var interceptors = []; diff --git a/packages/grpc-native-core/src/protobuf_js_5_common.js b/packages/grpc-native-core/src/protobuf_js_5_common.js index cf377d2b..3be4ef04 100644 --- a/packages/grpc-native-core/src/protobuf_js_5_common.js +++ b/packages/grpc-native-core/src/protobuf_js_5_common.js @@ -167,5 +167,5 @@ exports.loadObject = function loadObject(value, options) { * ReflectionObject */ exports.isProbablyProtobufJs5 = function isProbablyProtobufJs5(obj) { - return _.isArray(obj.children) && (typeof obj.build === 'function'); + return Array.isArray(obj.children) && (typeof obj.build === 'function'); }; diff --git a/packages/grpc-native-core/test/client_interceptors_test.js b/packages/grpc-native-core/test/client_interceptors_test.js index b14ec156..69cd25d7 100644 --- a/packages/grpc-native-core/test/client_interceptors_test.js +++ b/packages/grpc-native-core/test/client_interceptors_test.js @@ -39,7 +39,7 @@ var CallRegistry = function(done, expectation, is_ordered, is_verbose) { this.call_array = []; this.done = done; 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_verbose = is_verbose; if (is_verbose) {