Skip to content

isMap ​

The isMap function checks if the provided value is an instance of Map.

Syntax ​

typescript
isMap(value: any): value is Map<any, any>;

Parameters ​

ParameterTypeDescription
valueanyValue to be checked

Returns ​

TypeDescription
booleanTrue if it is an instance of Map

Examples ​

typescript
isMap(new Map()); // => true
isMap({}); // => false

Notes ​

  • Useful for validating collections before performing Map-specific operations.

References ​

Released under the MIT License.