set-species.js 601 B

123456789101112131415161718
  1. 'use strict';
  2. var getBuiltIn = require('../internals/get-built-in');
  3. var defineBuiltInAccessor = require('../internals/define-built-in-accessor');
  4. var wellKnownSymbol = require('../internals/well-known-symbol');
  5. var DESCRIPTORS = require('../internals/descriptors');
  6. var SPECIES = wellKnownSymbol('species');
  7. module.exports = function (CONSTRUCTOR_NAME) {
  8. var Constructor = getBuiltIn(CONSTRUCTOR_NAME);
  9. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  10. defineBuiltInAccessor(Constructor, SPECIES, {
  11. configurable: true,
  12. get: function () { return this; }
  13. });
  14. }
  15. };