_sub-array-dummy-safe.js 603 B

12345678910111213141516171819202122
  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, enumerable: false, writable: true, configurable: true }
  16. });
  17. return SubArray;
  18. })();