setProto.js 444 B

12345678910111213141516
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var originalSetProto = GetIntrinsic('%Object.setPrototypeOf%', true);
  4. var $ArrayProto = GetIntrinsic('%Array.prototype%');
  5. module.exports = originalSetProto || (
  6. // eslint-disable-next-line no-proto, no-negated-condition
  7. [].__proto__ !== $ArrayProto
  8. ? null
  9. : function (O, proto) {
  10. O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign
  11. return O;
  12. }
  13. );