# isWeakMap

# Description

检查 value 是否是 WeakMap 对象

# Params

value

# Return

Boolean

# Depend

import getTag from './.internal/getTag.js'
import isObjectLike from './isObjectLike.js'

getTag 源码分析

isObjectLike 源码分析

# Code

function isWeakMap(value) {
  return isObjectLike(value) && getTag(value) == '[object WeakMap]'
}

# Analyze

判断如果 valueobject, 并且 valuetag[object WeakMap], 都满足则说明是 WeakMap 对象

# Example

isWeakMap(new WeakMap)
// => true

isWeakMap(new Map)
// => false