@google-cloud/spanner
Version:
Cloud Spanner Client Library for Node.js
145 lines (144 loc) • 6 kB
TypeScript
/**
* Copyright 2024 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
*
* 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 { grpc } from 'google-gax';
/**
* Checks whether the given error is a 'Database not found' error.
* @param {Error} error The error to check.
* @return {boolean} True if the error is a 'Database not found' error, and otherwise false.
*/
export declare function isDatabaseNotFoundError(error: grpc.ServiceError | undefined): boolean;
/**
* Checks whether the given error is an 'Instance not found' error.
* @param {Error} error The error to check.
* @return {boolean} True if the error is an 'Instance not found' error, and otherwise false.
*/
export declare function isInstanceNotFoundError(error: grpc.ServiceError | undefined): boolean;
/**
* Checks whether the given error is a 'Could not load the default credentials' error.
* @param {Error} error The error to check.
* @return {boolean} True if the error is a 'Could not load the default credentials' error, and otherwise false.
*/
export declare function isDefaultCredentialsNotSetError(error: grpc.ServiceError | undefined): boolean;
/**
* Checks whether the given error is an 'Unable to detect a Project Id in the current environment' error.
* @param {Error} error The error to check.
* @return {boolean} True if the error is an 'Unable to detect a Project Id in the current environment' error, and otherwise false.
*/
export declare function isProjectIdNotSetInEnvironmentError(error: grpc.ServiceError | undefined): boolean;
/**
* Checks whether the given error is a 'Create session permission' error.
* @param {Error} error The error to check.
* @return {boolean} True if the error is a 'Create session permission' error, and otherwise false.
*/
export declare function isCreateSessionPermissionError(error: grpc.ServiceError | undefined): boolean;
/**
* Converts any value into an array. Acts as a replacement for `arrify`.
* If the value is null or undefined, returns an empty array.
* If the value is already an array, returns is unchanges.
* Otherwise, wraps the value in a new array.
* @param value The value to convert into an array.
* @returns An array containing the value, or an empty array.
*/
export declare function toArray(value: any): any[];
/**
* Checks if a value is defined.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is NOT `undefined`, otherwise `false`.
*/
export declare function isDefined(value: any): boolean;
/**
* Checks if a value is null.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is null, otherwise `false`.
*/
export declare function isNull(value: any): boolean;
/**
* Checks if a value is undefined.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is `undefined`, otherwise `false`.
*/
export declare function isUndefined(value: any): boolean;
/**
* Checks if a value is empty.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is empty, otherwise `false`.
*/
export declare function isEmpty(value: any): boolean;
/**
* Checks if a value is a plain javascript object.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is an object, otherwise `false`.
*/
export declare function isObject(value: any): boolean;
/**
* Checks if a value is a string.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is string, otherwise `false`.
*/
export declare function isString(value: any): boolean;
/**
* Checks if a value is an array.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is an array, otherwise `false`.
*/
export declare function isArray(value: any): boolean;
/**
* Checks if a value is a Date object.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is a `Date` object, otherwise `false`.
*/
export declare function isDate(value: any): boolean;
/**
* Checks if a value is a boolean.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is boolean, otherwise `false`.
*/
export declare function isBoolean(value: any): boolean;
/**
* Checks if a value is a number.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is a number, otherwise `false`.
*/
export declare function isNumber(value: any): boolean;
/**
* Checks if a value is an integer.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is an integer, otherwise `false`.
*/
export declare function isInteger(value: any): boolean;
/**
* Checks if a value is `NaN`.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is `NaN`, otherwise `false`.
*/
export declare function isActualNaN(value: any): boolean;
/**
* Checks if a value is a non-integer (decimal) number.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is a decimal number, otherwise `false`.
*/
export declare function isDecimal(value: any): boolean;
/**
* Checks if a value is `Infinity` or `-Infinity`.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is infinite, otherwise `false`.
*/
export declare function isInfinite(value: any): boolean;
/**
* Checks if a value is an `Error` object.
* @param {*} value The value to check.
* @returns {Boolean} `true` if the value is an `Error` object, otherwise `false`.
*/
export declare function isError(value: any): boolean;