|
Last change
on this file since ba17441 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
868 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Checks if the given value is object-like.
|
|---|
| 3 | *
|
|---|
| 4 | * A value is object-like if its type is object and it is not null.
|
|---|
| 5 | *
|
|---|
| 6 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like value.
|
|---|
| 7 | *
|
|---|
| 8 | * @param {any} value - The value to test if it is an object-like.
|
|---|
| 9 | * @returns {boolean} `true` if the value is an object-like, `false` otherwise.
|
|---|
| 10 | *
|
|---|
| 11 | * @example
|
|---|
| 12 | * const value1 = { a: 1 };
|
|---|
| 13 | * const value2 = [1, 2, 3];
|
|---|
| 14 | * const value3 = 'abc';
|
|---|
| 15 | * const value4 = () => {};
|
|---|
| 16 | * const value5 = null;
|
|---|
| 17 | *
|
|---|
| 18 | * console.log(isObjectLike(value1)); // true
|
|---|
| 19 | * console.log(isObjectLike(value2)); // true
|
|---|
| 20 | * console.log(isObjectLike(value3)); // false
|
|---|
| 21 | * console.log(isObjectLike(value4)); // false
|
|---|
| 22 | * console.log(isObjectLike(value5)); // false
|
|---|
| 23 | */
|
|---|
| 24 | declare function isObjectLike(value?: any): boolean;
|
|---|
| 25 |
|
|---|
| 26 | export { isObjectLike };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.