Skip to content

isWeakSet ​

The isWeakSet function checks if the provided value is an instance of WeakSet.

Syntax ​

typescript
isWeakSet(value: any): value is WeakSet<any>;

Parameters ​

ParameterTypeDescription
valueanyValue to be checked

Returns ​

TypeDescription
booleanTrue if it is an instance of WeakSet

Examples ​

typescript
isWeakSet(new WeakSet()); // => true
isWeakSet([]); // => false

Notes ​

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

References ​

Released under the MIT License.