source: trip-planner-front/node_modules/@babel/runtime/helpers/esm/set.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1import superPropBase from "./superPropBase.js";
2import defineProperty from "./defineProperty.js";
3
4function set(target, property, value, receiver) {
5 if (typeof Reflect !== "undefined" && Reflect.set) {
6 set = Reflect.set;
7 } else {
8 set = function set(target, property, value, receiver) {
9 var base = superPropBase(target, property);
10 var desc;
11
12 if (base) {
13 desc = Object.getOwnPropertyDescriptor(base, property);
14
15 if (desc.set) {
16 desc.set.call(receiver, value);
17 return true;
18 } else if (!desc.writable) {
19 return false;
20 }
21 }
22
23 desc = Object.getOwnPropertyDescriptor(receiver, property);
24
25 if (desc) {
26 if (!desc.writable) {
27 return false;
28 }
29
30 desc.value = value;
31 Object.defineProperty(receiver, property, desc);
32 } else {
33 defineProperty(receiver, property, value);
34 }
35
36 return true;
37 };
38 }
39
40 return set(target, property, value, receiver);
41}
42
43export default function _set(target, property, value, receiver, isStrict) {
44 var s = set(target, property, value, receiver || target);
45
46 if (!s && isStrict) {
47 throw new Error('failed to set property');
48 }
49
50 return value;
51}
Note: See TracBrowser for help on using the repository browser.