UNPKG

cumulocity-cypress

Version:
47 lines (46 loc) 2.21 kB
import { C8yTestHierarchyTree } from "./types"; export declare function safeStringify(obj: any, indent?: number): string; export declare function sanitizeStringifiedObject(value: string): string; /** * Gets the case-sensitive path for a given case-insensitive path. The path is * assumed to be a dot-separated string. If the path is an array, it is assumed * to be a list of keys. * * The function will go over all keys and return the actual case-sensitive path * up to the first mismatch. * * @param obj The object to query * @param path The case-insensitive path to find * @returns The actual case-sensitive path if found, undefined otherwise */ export declare function toSensitiveObjectKeyPath(obj: any, path: string | string[]): string | undefined; /** * Gets the value of a case-insensitive key path from an object. The path is * assumed to be a dot-separated string. If the path is an array, it is assumed * to be a list of keys. * * @example * geti(obj, "obj.key.token") * geti(obj, ["obj", "key", "token"]) * geti(obj, "obj.key[0].token") * geti(obj, "obj.key.0.token") * * @param obj The object to query * @param keyPath The case-insensitive key path to find * @returns The value of the key path if found, undefined otherwise */ export declare function get_i(obj: any, keyPath: string | string[]): any | undefined; /** * Converts a value to an array. If the value is an array, it is returned as is. * @param value The value to convert to an array * @returns The value as an array if it is not already an array */ export declare function to_array<T>(value: T | T[] | undefined): T[] | undefined; /** * Converts a string value to a boolean. Supported values are "true", "false", "1", and "0". * @param input The input string to convert to a boolean * @param defaultValue The default value to return if the input is not a valid boolean string * @returns The boolean value of the input string or the default value if the input is not a valid boolean string */ export declare function to_boolean(input: string, defaultValue: boolean): boolean; export declare function buildTestHierarchy<T>(objects: T[], hierarchyfn: (obj: T) => string[] | undefined): C8yTestHierarchyTree<T>;