esnext.composite-symbol.js 586 B

123456789101112
  1. var $ = require('../internals/export');
  2. var getCompositeKeyNode = require('../internals/composite-key');
  3. var getBuiltIn = require('../internals/get-built-in');
  4. var apply = require('../internals/function-apply');
  5. // https://github.com/tc39/proposal-richer-keys/tree/master/compositeKey
  6. $({ global: true, forced: true }, {
  7. compositeSymbol: function compositeSymbol() {
  8. if (arguments.length == 1 && typeof arguments[0] == 'string') return getBuiltIn('Symbol')['for'](arguments[0]);
  9. return apply(getCompositeKeyNode, null, arguments).get('symbol', getBuiltIn('Symbol'));
  10. }
  11. });