|
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:
947 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Checks if the given value is an object. An object is a value that is
|
|---|
| 3 | * not a primitive type (string, number, boolean, symbol, null, or undefined).
|
|---|
| 4 | *
|
|---|
| 5 | * This function tests whether the provided value is an object or not.
|
|---|
| 6 | * It returns `true` if the value is an object, and `false` otherwise.
|
|---|
| 7 | *
|
|---|
| 8 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object value.
|
|---|
| 9 | *
|
|---|
| 10 | * @param {any} value - The value to check if it is an object.
|
|---|
| 11 | * @returns {value is object} `true` if the value is an object, `false` otherwise.
|
|---|
| 12 | *
|
|---|
| 13 | * @example
|
|---|
| 14 | * const value1 = {};
|
|---|
| 15 | * const value2 = [1, 2, 3];
|
|---|
| 16 | * const value3 = () => {};
|
|---|
| 17 | * const value4 = null;
|
|---|
| 18 | *
|
|---|
| 19 | * console.log(isObject(value1)); // true
|
|---|
| 20 | * console.log(isObject(value2)); // true
|
|---|
| 21 | * console.log(isObject(value3)); // true
|
|---|
| 22 | * console.log(isObject(value4)); // false
|
|---|
| 23 | */
|
|---|
| 24 | declare function isObject(value?: any): value is object;
|
|---|
| 25 |
|
|---|
| 26 | export { isObject };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.