|
Last change
on this file since a762898 was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago |
|
Added visualizations
|
-
Property mode
set to
100644
|
|
File size:
803 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Checks if a given value is null or undefined.
|
|---|
| 3 | *
|
|---|
| 4 | * This function tests whether the provided value is either `null` or `undefined`.
|
|---|
| 5 | * It returns `true` if the value is `null` or `undefined`, and `false` otherwise.
|
|---|
| 6 | *
|
|---|
| 7 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.
|
|---|
| 8 | *
|
|---|
| 9 | * @param {unknown} x - The value to test for null or undefined.
|
|---|
| 10 | * @returns {boolean} `true` if the value is null or undefined, `false` otherwise.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * const value1 = null;
|
|---|
| 14 | * const value2 = undefined;
|
|---|
| 15 | * const value3 = 42;
|
|---|
| 16 | * const result1 = isNil(value1); // true
|
|---|
| 17 | * const result2 = isNil(value2); // true
|
|---|
| 18 | * const result3 = isNil(value3); // false
|
|---|
| 19 | */
|
|---|
| 20 | declare function isNil(x: unknown): x is null | undefined;
|
|---|
| 21 |
|
|---|
| 22 | export { isNil };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.