Skip to content

Commit 0cb9bb2

Browse files
authored
fix: remove is dependency (#6516)
1 parent ff41730 commit 0cb9bb2

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

packages/google-cloud-vision/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
},
5151
"dependencies": {
5252
"@google-cloud/promisify": "^5.0.0",
53-
"google-gax": "^5.0.0",
54-
"is": "^3.3.0"
53+
"google-gax": "^5.0.0"
5554
},
5655
"devDependencies": {
5756
"@google-cloud/storage": "^7.15.2",

packages/google-cloud-vision/src/helpers.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// ** All changes to this file may be overwritten. **
1818

1919
import * as fs from 'fs';
20-
import * as is from 'is';
2120
import {promisify} from '@google-cloud/promisify';
2221
import * as gax from 'google-gax';
2322
import * as protoTypes from '../protos/protos';
@@ -91,7 +90,7 @@ interface VisionClient {
9190

9291
// eslint-disable-next-line @typescript-eslint/no-explicit-any
9392
const _requestToObject = (request: any) => {
94-
if (is.string(request)) {
93+
if ((typeof request === 'string')) {
9594
// Is this a URL or a local file?
9695
// Guess based on what the string looks like, and build the full
9796
// request object in the correct format.
@@ -122,7 +121,7 @@ const _coerceRequest = (
122121
) => {
123122
// At this point, request must be an object with an `image` key; if not,
124123
// it is an error. If there is no image, throw an exception.
125-
if (!is.object(request) || is.undefined(request.image)) {
124+
if ((typeof request !== 'object') || !(request.image)) {
126125
return callback(new Error('No image present.'));
127126
}
128127
// If this is a buffer, read it and send the object
@@ -183,7 +182,7 @@ const _createSingleFeatureMethod = (
183182
// If a callback was provided and options were skipped, normalize
184183
// the argument names.
185184
let callOptions: gax.CallOptions | undefined;
186-
if (is.undefined(callback) && is.function(callOptionsOrCallback)) {
185+
if (!callback && (typeof callOptionsOrCallback === 'function')) {
187186
callback = callOptionsOrCallback as gax.Callback<
188187
protoTypes.google.cloud.vision.v1.IAnnotateImageResponse,
189188
{},
@@ -296,7 +295,7 @@ export function call(apiVersion: string) {
296295
// If a callback was provided and options were skipped, normalize
297296
// the argument names.
298297
let callOptions: gax.CallOptions | undefined;
299-
if (is.undefined(callback) && is.function(callOptionsOrCallback)) {
298+
if (!callback && (typeof callOptionsOrCallback === 'function')) {
300299
callback = callOptionsOrCallback as gax.Callback<
301300
protoTypes.google.cloud.vision.v1.IAnnotateImageResponse,
302301
{},

packages/google-cloud-vision/test/helpers.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import {describe, it, afterEach} from 'mocha';
1818
import * as path from 'path';
19-
import * as is from 'is';
2019
import * as sinon from 'sinon';
2120
import * as prototypes from '../protos/protos';
2221
import * as assert from 'assert';
@@ -236,7 +235,7 @@ describe('Vision helper methods', () => {
236235
};
237236
client.annotateImage(request, (err: {}, response: {}) => {
238237
// Establish that we got the expected response.
239-
assert(is.undefined(err));
238+
assert(!err);
240239
assert.deepStrictEqual(response, {
241240
logoAnnotations: [{description: 'Google'}],
242241
});

0 commit comments

Comments
 (0)