set.js 774 B

12345678910111213141516171819202122
  1. import superPropBase from "./superPropBase.js";
  2. import defineProperty from "./defineProperty.js";
  3. function set(e, r, t, o) {
  4. return set = "undefined" != typeof Reflect && Reflect.set ? Reflect.set : function (e, r, t, o) {
  5. var f,
  6. i = superPropBase(e, r);
  7. if (i) {
  8. if ((f = Object.getOwnPropertyDescriptor(i, r)).set) return f.set.call(o, t), !0;
  9. if (!f.writable) return !1;
  10. }
  11. if (f = Object.getOwnPropertyDescriptor(o, r)) {
  12. if (!f.writable) return !1;
  13. f.value = t, Object.defineProperty(o, r, f);
  14. } else defineProperty(o, r, t);
  15. return !0;
  16. }, set(e, r, t, o);
  17. }
  18. function _set(e, r, t, o, f) {
  19. if (!set(e, r, t, o || e) && f) throw new TypeError("failed to set property");
  20. return t;
  21. }
  22. export { _set as default };