|
17 | 17 | // ** All changes to this file may be overwritten. ** |
18 | 18 |
|
19 | 19 | import * as fs from 'fs'; |
20 | | -import * as is from 'is'; |
21 | 20 | import {promisify} from '@google-cloud/promisify'; |
22 | 21 | import * as gax from 'google-gax'; |
23 | 22 | import * as protoTypes from '../protos/protos'; |
@@ -91,7 +90,7 @@ interface VisionClient { |
91 | 90 |
|
92 | 91 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
93 | 92 | const _requestToObject = (request: any) => { |
94 | | - if (is.string(request)) { |
| 93 | + if ((typeof request === 'string')) { |
95 | 94 | // Is this a URL or a local file? |
96 | 95 | // Guess based on what the string looks like, and build the full |
97 | 96 | // request object in the correct format. |
@@ -122,7 +121,7 @@ const _coerceRequest = ( |
122 | 121 | ) => { |
123 | 122 | // At this point, request must be an object with an `image` key; if not, |
124 | 123 | // 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)) { |
126 | 125 | return callback(new Error('No image present.')); |
127 | 126 | } |
128 | 127 | // If this is a buffer, read it and send the object |
@@ -183,7 +182,7 @@ const _createSingleFeatureMethod = ( |
183 | 182 | // If a callback was provided and options were skipped, normalize |
184 | 183 | // the argument names. |
185 | 184 | let callOptions: gax.CallOptions | undefined; |
186 | | - if (is.undefined(callback) && is.function(callOptionsOrCallback)) { |
| 185 | + if (!callback && (typeof callOptionsOrCallback === 'function')) { |
187 | 186 | callback = callOptionsOrCallback as gax.Callback< |
188 | 187 | protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, |
189 | 188 | {}, |
@@ -296,7 +295,7 @@ export function call(apiVersion: string) { |
296 | 295 | // If a callback was provided and options were skipped, normalize |
297 | 296 | // the argument names. |
298 | 297 | let callOptions: gax.CallOptions | undefined; |
299 | | - if (is.undefined(callback) && is.function(callOptionsOrCallback)) { |
| 298 | + if (!callback && (typeof callOptionsOrCallback === 'function')) { |
300 | 299 | callback = callOptionsOrCallback as gax.Callback< |
301 | 300 | protoTypes.google.cloud.vision.v1.IAnnotateImageResponse, |
302 | 301 | {}, |
|
0 commit comments