/** * Map for storing mappings from an index to a value. * * @class IndexMap */ export declare class IndexMap { /** * List of values for particular indexes. * * @private * @type {Array} */ indexedValues: unknown[]; /** * Initial value or function for each existing index. * * @private * @type {*} */ initValueOrFn: unknown; /** * Triggers all callbacks registered under the given local hook name, returning any results. */ runLocalHooks: (key: string, ...args: unknown[]) => unknown; /** * Registers a callback function for the given local hook name on this map instance. */ addLocalHook: (key: string, callback: Function) => unknown; /** * Removes all locally registered hook callbacks from this map instance. */ clearLocalHooks: () => void; /** * Initializes the index map with an optional default value or factory function applied to each index. */ constructor(initValueOrFn?: unknown); /** * Get full list of values for particular indexes. * * @param {*} [unused] Unused parameter for TypeScript compatibility. * @returns {Array} */ getValues(unused?: unknown): unknown[]; /** * Get value for the particular index. * * @param {number} index Index for which value is got. * @returns {T | undefined} */ getValueAtIndex(index: number): T | undefined; /** * Set new values for particular indexes. * * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. * * @param {Array} values List of set values. */ setValues(values: unknown[]): void; /** * Set new value for the particular index. * * @param {number} index The index. * @param {*} value The value to save. * * Note: Please keep in mind that it is not possible to set value beyond the map (not respecting already set * map's size). Please use the `setValues` method when you would like to extend the map. * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. * * @returns {boolean} */ setValueAtIndex(index: number, value: unknown): boolean; /** * Clear all values to the defaults. */ clear(): void; /** * Get length of the index map. * * @returns {number} */ getLength(): number; /** * Set default values for elements from `0` to `n`, where `n` is equal to the handled variable. * * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. * * @private * @param {number} [length] Length of list. */ setDefaultValues(length?: number): void; /** * Initialize list with default values for particular indexes. * * @private * @param {number} length New length of indexed list. * @returns {IndexMap} */ init(length: number): this; /** * Add values to the list. * * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. * * @private * @param {number} [insertionIndex] Position inside the list. * @param {Array} [insertedIndexes] List of inserted indexes. */ insert(insertionIndex?: number, insertedIndexes?: number[]): void; /** * Remove values from the list. * * Note: Please keep in mind that `change` hook triggered by the method may not update cache of a collection immediately. * * @private * @param {Array} [removedIndexes] List of removed indexes. */ remove(removedIndexes?: number[]): void; /** * Destroys the Map instance. */ destroy(): void; }