|
Last change
on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
948 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * This function retrieves the names of string-keyed properties from an object, including those inherited from its prototype.
|
|---|
| 3 | *
|
|---|
| 4 | * - If the value is not an object, it is converted to an object.
|
|---|
| 5 | * - Array-like objects are treated like arrays.
|
|---|
| 6 | * - Sparse arrays with some missing indices are treated like dense arrays.
|
|---|
| 7 | * - If the value is `null` or `undefined`, an empty array is returned.
|
|---|
| 8 | * - When handling prototype objects, the `constructor` property is excluded from the results.
|
|---|
| 9 | *
|
|---|
| 10 | * @param {any} [object] - The object to inspect for keys.
|
|---|
| 11 | * @returns {string[]} An array of string keys from the object.
|
|---|
| 12 | *
|
|---|
| 13 | * @example
|
|---|
| 14 | * const obj = { a: 1, b: 2 };
|
|---|
| 15 | * console.log(keysIn(obj)); // ['a', 'b']
|
|---|
| 16 | *
|
|---|
| 17 | * const arr = [1, 2, 3];
|
|---|
| 18 | * console.log(keysIn(arr)); // ['0', '1', '2']
|
|---|
| 19 | *
|
|---|
| 20 | * function Foo() {}
|
|---|
| 21 | * Foo.prototype.a = 1;
|
|---|
| 22 | * console.log(keysIn(new Foo())); // ['a']
|
|---|
| 23 | */
|
|---|
| 24 | declare function keysIn(object?: any): string[];
|
|---|
| 25 |
|
|---|
| 26 | export { keysIn };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.