UNPKG

@storm-stack/types

Version:

⚡ The storm-stack monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.

36 lines (35 loc) 1.1 kB
import { DeepKey } from "../utility-types/object"; /** * Checks if a given key is a deep key. * * A deep key is a string that contains a dot (.) or square brackets with a property accessor. * * @example * isDeepKey('a.b') // true * isDeepKey('a[b]') // true * isDeepKey('a') // false * isDeepKey(123) // false * isDeepKey('a.b.c') // true * isDeepKey('a[b][c]') // true * * @param key - The key to check. * @returns Returns true if the key is a deep key, otherwise false. */ export declare function isDeepKey(key: PropertyKey): key is DeepKey<any>; /** * Checks if a given key is a deep key or normal (shallow key). * * A deep key is a string that contains a dot (.) or square brackets with a property accessor. * * @example * isDeepKey('a.b') // true * isDeepKey('a[b]') // true * isDeepKey('a') // true * isDeepKey(123) // false * isDeepKey('a.b.c') // true * isDeepKey('a[b][c]') // true * * @param key - The key to check. * @returns Returns true if the key is a deep key, otherwise false. */ export declare function isKeyOrDeepKey(key: PropertyKey): key is DeepKey<any>;