Skip to content

Commit

Permalink
refactor: drop dependency on is (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinBeckwith authored Mar 19, 2020
1 parent 742e0d2 commit 34fd214
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 53 deletions.
2 changes: 0 additions & 2 deletions packages/google-cloud-translate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@
"arrify": "^2.0.0",
"extend": "^3.0.2",
"google-gax": "^1.11.1",
"is": "^3.2.1",
"is-html": "^2.0.0",
"protobufjs": "^6.8.8"
},
"devDependencies": {
"@types/extend": "^3.0.0",
"@types/is": "0.0.21",
"@types/mocha": "^7.0.0",
"@types/node": "^10.5.7",
"@types/proxyquire": "^1.3.28",
Expand Down
28 changes: 13 additions & 15 deletions packages/google-cloud-translate/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
/*!
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as v2 from './v2';

Expand Down
11 changes: 5 additions & 6 deletions packages/google-cloud-translate/src/v2/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright 2017, Google LLC All rights reserved.
// Copyright 2017 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -17,7 +17,6 @@ import {promisifyAll} from '@google-cloud/promisify';
import arrify = require('arrify');
import * as extend from 'extend';
import {GoogleAuthOptions} from 'google-auth-library';
import * as is from 'is';

const isHtml = require('is-html');
import {
Expand Down Expand Up @@ -331,7 +330,7 @@ export class Translate extends Service {
callback?: GetLanguagesCallback
): void | Promise<[LanguageResult[], Metadata]> {
let target: string;
if (is.fn(targetOrCallback)) {
if (typeof targetOrCallback === 'function') {
callback = targetOrCallback as GetLanguagesCallback;
target = 'en';
} else {
Expand All @@ -344,7 +343,7 @@ export class Translate extends Service {
qs: {},
} as DecorateRequestOptions;

if (target && is.string(target)) {
if (target && typeof target === 'string') {
reqOpts.qs.target = target;
}

Expand Down Expand Up @@ -516,7 +515,7 @@ export class Translate extends Service {
format: options.format || (isHtml(input[0]) ? 'html' : 'text'),
};

if (is.string(options)) {
if (typeof options === 'string') {
body.target = options;
} else {
if (options.from) {
Expand Down
28 changes: 13 additions & 15 deletions packages/google-cloud-translate/system-test/translate.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
/*!
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import * as assert from 'assert';
import {describe, it} from 'mocha';
Expand Down
28 changes: 13 additions & 15 deletions packages/google-cloud-translate/test/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
/*!
* Copyright 2015 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2015 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import {DecorateRequestOptions, util} from '@google-cloud/common';
import {
Expand Down

0 comments on commit 34fd214

Please sign in to comment.