isSymbol.js 392 B

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