UNPKG

@aedart/support

Version:

The Ion support package

95 lines (84 loc) 2.36 kB
/** * @aedart/support * * BSD-3-Clause, Copyright (c) 2023-present Alin Eugen Deac <aedart@gmail.com>. */ import { Key } from '@aedart/contracts/support'; /** * Return the default string description of an object * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString * * @param {any} value * * @returns {string} */ declare function descTag(value: any): string; /** * Determine if value is empty * * @param {any} value * * @returns {boolean} */ declare function empty(value: any): boolean; /** * Determine if given is a valid {@link import('@aedart/contracts/support').Key} * * @see {isPropertyKey} * * @param {any} key * * @returns {boolean} */ declare function isKey(key: any): boolean; /** * Determine if value is a {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#primitive_values primitive value}. * * @param {unknown} value * * @returns {boolean} */ declare function isPrimitive(value: unknown): boolean; /** * Determine if given key is a valid property key name * * @see {PropertyKey} * * @param {any} key * * @returns {boolean} True if typeof key is a string, number or symbol */ declare function isPropertyKey(key: any): boolean; /** * Determine if value(s) are different from undefined and null * * @param {...any} values * * @returns {boolean} */ declare function isset(...values: any[]): boolean; /** * Merge multiple {@link Key}s into a single key * * @param {...Key} keys * * @return {Key} Merged key. Empty key if no arguments given. * * @throws {TypeError} If an argument is not a valid key */ declare function mergeKeys(...keys: Key[]): Key; /** * Wraps target into a {@link WeakRef}, if target is not already a weak reference * * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef * * @template {WeakKey} T * * @param {WeakRef<T> | T | undefined} target * * @return {WeakRef<T> | undefined} Returns undefined if given target is undefined */ declare function toWeakRef<T extends WeakKey>(target: WeakRef<T> | T | undefined): WeakRef<T> | undefined; export { descTag, empty, isKey, isPrimitive, isPropertyKey, isset, mergeKeys, toWeakRef };