From a9a3ef24e901f2064db9c949dc3d23fcea137ff4 Mon Sep 17 00:00:00 2001 From: Jun Mukai Date: Wed, 17 Aug 2016 13:20:50 -0700 Subject: [PATCH] Introduce extend() for merging options with default scope. --- packages/language/src/v1beta1/index.js | 8 ++++---- packages/language/src/v1beta1/language_service_api.js | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/language/src/v1beta1/index.js b/packages/language/src/v1beta1/index.js index 65ecda261207..2a00e520c12e 100644 --- a/packages/language/src/v1beta1/index.js +++ b/packages/language/src/v1beta1/index.js @@ -16,13 +16,13 @@ 'use strict'; var languageServiceApi = require('./language_service_api'); +var extend = require('extend'); var gax = require('google-gax'); function v1beta1(options) { - options = options || {}; - if (!('scopes' in options)) { - options.scopes = v1beta1.ALL_SCOPES; - } + options = extend({ + scopes: v1beta1.ALL_SCOPES + }, options); var gaxGrpc = gax.grpc(options); return languageServiceApi(gaxGrpc); } diff --git a/packages/language/src/v1beta1/language_service_api.js b/packages/language/src/v1beta1/language_service_api.js index 8271468b11fe..40e361aa98e9 100644 --- a/packages/language/src/v1beta1/language_service_api.js +++ b/packages/language/src/v1beta1/language_service_api.js @@ -79,7 +79,6 @@ function LanguageServiceApi(gaxGrpc, grpcClient, opts) { var appName = opts.appName || 'gax'; var appVersion = opts.appVersion || gax.Version; - var googleApiClient = [ appName + '/' + appVersion, CODE_GEN_NAME_VERSION, @@ -236,6 +235,6 @@ module.exports = function build(gaxGrpc) { return new LanguageServiceApi(gaxGrpc, grpcClient, opts); }; return built; -} +}; module.exports.SERVICE_ADDRESS = SERVICE_ADDRESS; module.exports.ALL_SCOPES = ALL_SCOPES; \ No newline at end of file