esnext.composite-symbol.js 601 B

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