@barchart/common-js
Version:
Library of common JavaScript utilities
54 lines (53 loc) • 1.3 kB
TypeScript
/**
* A map that stores data using a compound key -- without the need
* to implement objects needing to implement equals and hashcode.
*
* @public
*/
export default class CompoundMap {
/**
* @param {number} depth - The number of keys.
*/
constructor(depth: number);
/**
* Returns true if the map has a value (or a grouping of values) at the
* given key.
*
* @public
* @param {...string} keys
* @returns {boolean}
*/
public has(...keys: string[]): boolean;
/**
* Puts a value into the map, overwriting any preexisting value.
*
* @public
* @param {*} value
* @param {...string} keys
*/
public put(value: any, ...keys: string[]): void;
/**
* Gets a value from the map, returning null if the value does not exist.
*
* @public
* @param {...string} keys
* @returns {*}
*/
public get(...keys: string[]): any;
/**
* Deletes a value (or a group of values) from the tree.
*
* @public
* @param {...string} keys
* @returns {boolean}
*/
public remove(...keys: string[]): boolean;
/**
* Returns a string representation.
*
* @public
* @returns {string}
*/
public toString(): string;
#private;
}