Skip to content

isWeakMap

Returns true for WeakMap instances

130 bytes

Usage

Returns true for WeakMap instances, even if they are subclass instances or from other realms.

import * as
import _
_
from 'radashi'
import _
_
.
isWeakMap<object, unknown>(value: unknown): value is WeakMap<object, unknown>
export isWeakMap

Checks if the given value is a WeakMap.

Instances from other realms are also supported.

@seehttps://radashi.js.org/reference/typed/isWeakMap

@example

isWeakMap(new WeakMap()) // => true
isWeakMap(new Map()) // => false

@version12.2.0

isWeakMap
(new
var WeakMap: WeakMapConstructor
new <object, any>(entries?: readonly (readonly [object, any])[] | null | undefined) => WeakMap<object, any> (+1 overload)
WeakMap
()) // true
import _
_
.
isWeakMap<object, unknown>(value: unknown): value is WeakMap<object, unknown>
export isWeakMap

Checks if the given value is a WeakMap.

Instances from other realms are also supported.

@seehttps://radashi.js.org/reference/typed/isWeakMap

@example

isWeakMap(new WeakMap()) // => true
isWeakMap(new Map()) // => false

@version12.2.0

isWeakMap
(new (class extends
var WeakMap: WeakMapConstructor
WeakMap
{})()) // true