@studiohyperdrive/utils
Version:
A package containing common Javascript utils.
16 lines (15 loc) • 496 B
TypeScript
/**
* getKeyByValue
*
* The getKeyByValue helper function will search for a key within an object, based on the provided value.
* This function should work with both plain objects and enums.
* It will return the first key found. If a value exists more than once,
* it will only return the key of the first corresponding value.
*
* @param object
* @param value
* @returns string
*/
export declare const getKeyByValue: (object: {
[key: string]: unknown;
}, value: unknown) => string;