mirror of
https://github.com/nodejs/node.git
synced 2025-05-18 17:26:24 +00:00

PR-URL: https://github.com/nodejs/io.js/pull/2286 Reviewed-By: Roman Reiss <me@silverwind.io>
19 lines
599 B
JavaScript
19 lines
599 B
JavaScript
'use strict';
|
|
|
|
module.exports = function () {
|
|
var symbol;
|
|
if (typeof Symbol !== 'function') return false;
|
|
symbol = Symbol('test symbol');
|
|
try { String(symbol); } catch (e) { return false; }
|
|
if (typeof Symbol.iterator === 'symbol') return true;
|
|
|
|
// Return 'true' for polyfills
|
|
if (typeof Symbol.isConcatSpreadable !== 'object') return false;
|
|
if (typeof Symbol.iterator !== 'object') return false;
|
|
if (typeof Symbol.toPrimitive !== 'object') return false;
|
|
if (typeof Symbol.toStringTag !== 'object') return false;
|
|
if (typeof Symbol.unscopables !== 'object') return false;
|
|
|
|
return true;
|
|
};
|