_sub-array-dummy-safe.js 606 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. var setPrototypeOf = require("../object/set-prototype-of")
  3. , isExtensible = require("./_is-extensible");
  4. module.exports = (function () {
  5. var SubArray;
  6. if (isExtensible) return require("./_sub-array-dummy");
  7. if (!setPrototypeOf) return null;
  8. SubArray = function () {
  9. var arr = Array.apply(this, arguments);
  10. setPrototypeOf(arr, SubArray.prototype);
  11. return arr;
  12. };
  13. setPrototypeOf(SubArray, Array);
  14. SubArray.prototype = Object.create(Array.prototype, {
  15. constructor: { value: SubArray,
  16. enumerable: false,
  17. writable: true,
  18. configurable: true }
  19. });
  20. return SubArray;
  21. }());