isWeakMap.js 353 B

123456789101112131415
  1. /* eslint-disable valid-typeof */
  2. var staticStrUndefined = require('./staticStrUndefined')
  3. /**
  4. * 判断是否WeakMap对象
  5. *
  6. * @param {Object} obj 对象
  7. * @return {Boolean}
  8. */
  9. var supportWeakMap = typeof WeakMap !== staticStrUndefined
  10. function isWeakMap (obj) {
  11. return supportWeakMap && obj instanceof WeakMap
  12. }
  13. module.exports = isWeakMap