is-implemented.js 599 B

123456789101112131415161718
  1. 'use strict';
  2. module.exports = function () {
  3. var symbol;
  4. if (typeof Symbol !== 'function') return false;
  5. symbol = Symbol('test symbol');
  6. try { String(symbol); } catch (e) { return false; }
  7. if (typeof Symbol.iterator === 'symbol') return true;
  8. // Return 'true' for polyfills
  9. if (typeof Symbol.isConcatSpreadable !== 'object') return false;
  10. if (typeof Symbol.iterator !== 'object') return false;
  11. if (typeof Symbol.toPrimitive !== 'object') return false;
  12. if (typeof Symbol.toStringTag !== 'object') return false;
  13. if (typeof Symbol.unscopables !== 'object') return false;
  14. return true;
  15. };