setProto.js 352 B

1234567891011121314151617
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var originalSetProto = GetIntrinsic('%Object.setPrototypeOf%', true);
  4. var hasProto = require('has-proto')();
  5. module.exports = originalSetProto || (
  6. hasProto
  7. ? function (O, proto) {
  8. O.__proto__ = proto; // eslint-disable-line no-proto, no-param-reassign
  9. return O;
  10. }
  11. : null
  12. );