The isWeakSet
function in the Underscore library checks if a value is a WeakSet object or not. Here's an example of how to use it:
index.tsx205 chars8 lines
In the example above, we create a Set
object called mySet
and a WeakSet
object called myWeakSet
. We then use the isWeakSet
function to check if each object is a WeakSet
or not. The first call to isWeakSet
returns false
because mySet
is a Set
, not a WeakSet
, while the second call returns true
because myWeakSet
is indeed a WeakSet
.
Note that the isWeakSet
function is only available in the Underscore library version 1.10.0 or higher.
gistlibby LogSnag