|
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:
626 bytes
|
| Rev | Line | |
|---|
| [a762898] | 1 | /**
|
|---|
| 2 | * Checks if a given value is `Map`.
|
|---|
| 3 | *
|
|---|
| 4 | * This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Map`.
|
|---|
| 5 | *
|
|---|
| 6 | * @param {unknown} value The value to check if it is a `Map`.
|
|---|
| 7 | * @returns {value is Map<any, any>} Returns `true` if `value` is a `Map`, else `false`.
|
|---|
| 8 | *
|
|---|
| 9 | * @example
|
|---|
| 10 | * const value1 = new Map();
|
|---|
| 11 | * const value2 = new Set();
|
|---|
| 12 | * const value3 = new WeakMap();
|
|---|
| 13 | *
|
|---|
| 14 | * console.log(isMap(value1)); // true
|
|---|
| 15 | * console.log(isMap(value2)); // false
|
|---|
| 16 | * console.log(isMap(value3)); // false
|
|---|
| 17 | */
|
|---|
| 18 | declare function isMap(value: unknown): value is Map<any, any>;
|
|---|
| 19 |
|
|---|
| 20 | export { isMap };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.