Files
admin/packages/utils/src/object/keys.ts
T
2026-06-25 15:53:49 +03:00

15 lines
385 B
TypeScript
Executable File

/**
* Return an array of keys from an object.
*
* @param object - The object from which to extract the keys.
* @returns An array of keys from the object.
*
* @example
* const obj = { a: 1, b: 2, c: 3 };
* const result = keys(obj);
* // result: ['a', 'b', 'c']
*/
export function keys<T extends object>(object: T): (keyof T)[] {
return Object.keys(object) as (keyof T)[];
}