UNPKG

@typescript-package/data

Version:

A lightweight TypeScript library for basic data management.

56 lines (55 loc) 1.29 kB
import { WeakData } from "./weak-data.class"; /** * @description * @export * @class IndexedWeakData * @template {object} [Obj=object] * @template {keyof Obj} [Key=keyof Obj] * @extends {WeakData<Obj>} */ export declare class IndexedWeakData<Obj extends object = object, Key extends keyof Obj = keyof Obj> extends WeakData<Obj> { #private; /** * @description * @public * @static * @template {object} [Obj=object] * @param {number} index * @returns {(Obj | undefined)} */ static getByIndex<Obj extends object = object>(index: number): Obj | undefined; /** * @description * @public * @readonly * @type {(number | undefined)} */ get index(): number | undefined; /** * @description * @public * @readonly * @type {Key} */ get key(): Key; /** * Creates an instance of `IndexedWeakData`. * @constructor * @param {Obj} object * @param {Key} key */ constructor(object: Obj, key: Key); /** * @inheritdoc * @public * @returns {this} */ destroy(): this; /** * @description * @public * @param {number} index * @returns {(Obj | undefined)} */ getByIndex(index: number): Obj | undefined; }