source: trip-planner-front/node_modules/@babel/runtime/helpers/set.js@ bdd6491

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

initial commit

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