set-species.js 638 B

12345678910111213141516171819
  1. 'use strict';
  2. var getBuiltIn = require('../internals/get-built-in');
  3. var definePropertyModule = require('../internals/object-define-property');
  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. var defineProperty = definePropertyModule.f;
  10. if (DESCRIPTORS && Constructor && !Constructor[SPECIES]) {
  11. defineProperty(Constructor, SPECIES, {
  12. configurable: true,
  13. get: function () { return this; }
  14. });
  15. }
  16. };