Skip to content

isSet ​

The isSet function checks if the provided value is an instance of Set.

Syntax ​

typescript
isSet(value: any): value is Set<any>;

Parameters ​

ParameterTypeDescription
valueanyValue to be checked

Returns ​

TypeDescription
booleanTrue if it is an instance of Set

Examples ​

typescript
isSet(new Set()); // => true
isSet([]); // => false

Notes ​

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

References ​

Released under the MIT License.