Initial commit
This commit is contained in:
Executable
+14
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* 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)[];
|
||||
}
|
||||
Reference in New Issue
Block a user