|
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:
833 bytes
|
| Line | |
|---|
| 1 | /**
|
|---|
| 2 | * Checks if the given value is a `WeakMap`.
|
|---|
| 3 | *
|
|---|
| 4 | * This function tests whether the provided value is an instance of `WeakMap`.
|
|---|
| 5 | * It returns `true` if the value is a `WeakMap`, and `false` otherwise.
|
|---|
| 6 | *
|
|---|
| 7 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `WeakMap`.
|
|---|
| 8 | *
|
|---|
| 9 | * @param {unknown} value - The value to test if it is a `WeakMap`.
|
|---|
| 10 | * @returns {value is WeakMap<WeakKey, any>} true if the value is a `WeakMap`, false otherwise.
|
|---|
| 11 | *
|
|---|
| 12 | * @example
|
|---|
| 13 | * const value1 = new WeakMap();
|
|---|
| 14 | * const value2 = new Map();
|
|---|
| 15 | * const value3 = new Set();
|
|---|
| 16 | *
|
|---|
| 17 | * console.log(isWeakMap(value1)); // true
|
|---|
| 18 | * console.log(isWeakMap(value2)); // false
|
|---|
| 19 | * console.log(isWeakMap(value3)); // false
|
|---|
| 20 | */
|
|---|
| 21 | declare function isWeakMap(value: unknown): value is WeakMap<WeakKey, any>;
|
|---|
| 22 |
|
|---|
| 23 | export { isWeakMap };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.