mobx 6.3.13 → 6.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +1 -0
  3. package/dist/errors.d.ts +2 -2
  4. package/dist/mobx.cjs.development.js +940 -263
  5. package/dist/mobx.cjs.development.js.map +1 -1
  6. package/dist/mobx.cjs.production.min.js.map +1 -1
  7. package/dist/mobx.esm.development.js +940 -263
  8. package/dist/mobx.esm.development.js.map +1 -1
  9. package/dist/mobx.esm.js +958 -269
  10. package/dist/mobx.esm.js.map +1 -1
  11. package/dist/mobx.esm.production.min.js.map +1 -1
  12. package/dist/mobx.umd.development.js +940 -263
  13. package/dist/mobx.umd.development.js.map +1 -1
  14. package/dist/mobx.umd.production.min.js.map +1 -1
  15. package/dist/types/observablemap.d.ts +2 -2
  16. package/dist/utils/utils.d.ts +1 -1
  17. package/package.json +1 -1
  18. package/src/api/action.ts +8 -3
  19. package/src/api/annotation.ts +1 -2
  20. package/src/api/autorun.ts +22 -8
  21. package/src/api/computed.ts +5 -2
  22. package/src/api/configure.ts +6 -2
  23. package/src/api/extendobservable.ts +11 -5
  24. package/src/api/extras.ts +4 -2
  25. package/src/api/flow.ts +11 -4
  26. package/src/api/intercept-read.ts +4 -2
  27. package/src/api/intercept.ts +5 -2
  28. package/src/api/iscomputed.ts +10 -4
  29. package/src/api/isobservable.ts +10 -4
  30. package/src/api/makeObservable.ts +4 -2
  31. package/src/api/object-api.ts +30 -16
  32. package/src/api/observable.ts +23 -9
  33. package/src/api/observe.ts +4 -2
  34. package/src/api/tojs.ts +7 -3
  35. package/src/api/trace.ts +6 -2
  36. package/src/api/when.ts +12 -5
  37. package/src/core/action.ts +8 -3
  38. package/src/core/computedvalue.ts +29 -9
  39. package/src/core/derivation.ts +25 -9
  40. package/src/core/globalstate.ts +18 -7
  41. package/src/core/observable.ts +14 -5
  42. package/src/core/reaction.ts +15 -6
  43. package/src/core/spy.ts +20 -7
  44. package/src/errors.ts +2 -2
  45. package/src/types/actionannotation.ts +2 -2
  46. package/src/types/dynamicobject.ts +10 -4
  47. package/src/types/flowannotation.ts +3 -1
  48. package/src/types/intercept-utils.ts +9 -3
  49. package/src/types/legacyobservablearray.ts +5 -3
  50. package/src/types/listen-utils.ts +6 -2
  51. package/src/types/modifiers.ts +39 -14
  52. package/src/types/observablearray.ts +78 -30
  53. package/src/types/observablemap.ts +60 -24
  54. package/src/types/observableobject.ts +52 -18
  55. package/src/types/observableset.ts +29 -10
  56. package/src/types/observablevalue.ts +13 -5
  57. package/src/types/type-utils.ts +33 -11
  58. package/src/utils/comparer.ts +4 -4
  59. package/src/utils/eq.ts +45 -15
  60. package/src/utils/utils.ts +42 -20
@@ -23,9 +23,9 @@ var niceErrors = {
23
23
  10: "'has()' can only be used on observable objects, arrays and maps",
24
24
  11: "'get()' can only be used on observable objects, arrays and maps",
25
25
  12: "Invalid annotation",
26
- 13: "Dynamic observable objects cannot be frozen",
26
+ 13: "Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",
27
27
  14: "Intercept handlers should return nothing or a change object",
28
- 15: "Observable arrays cannot be frozen",
28
+ 15: "Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)",
29
29
  16: "Modification exception: the internal structure of an observable array was changed.",
30
30
  17: function _(index, length) {
31
31
  return "[mobx.array] Index out of bounds, " + index + " is larger than " + length;
@@ -139,7 +139,10 @@ function getNextId() {
139
139
  function once(func) {
140
140
  var invoked = false;
141
141
  return function () {
142
- if (invoked) return;
142
+ if (invoked) {
143
+ return;
144
+ }
145
+
143
146
  invoked = true;
144
147
  return func.apply(this, arguments);
145
148
  };
@@ -164,17 +167,31 @@ function isObject(value) {
164
167
  return value !== null && typeof value === "object";
165
168
  }
166
169
  function isPlainObject(value) {
167
- if (!isObject(value)) return false;
170
+ if (!isObject(value)) {
171
+ return false;
172
+ }
173
+
168
174
  var proto = Object.getPrototypeOf(value);
169
- if (proto == null) return true;
175
+
176
+ if (proto == null) {
177
+ return true;
178
+ }
179
+
170
180
  var protoConstructor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
171
181
  return typeof protoConstructor === "function" && protoConstructor.toString() === plainObjectString;
172
182
  } // https://stackoverflow.com/a/37865170
173
183
 
174
184
  function isGenerator(obj) {
175
185
  var constructor = obj == null ? void 0 : obj.constructor;
176
- if (!constructor) return false;
177
- if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) return true;
186
+
187
+ if (!constructor) {
188
+ return false;
189
+ }
190
+
191
+ if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) {
192
+ return true;
193
+ }
194
+
178
195
  return false;
179
196
  }
180
197
  function addHiddenProp(object, propName, value) {
@@ -214,9 +231,16 @@ var hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== "undefine
214
231
  function getPlainObjectKeys(object) {
215
232
  var keys = Object.keys(object); // Not supported in IE, so there are not going to be symbol props anyway...
216
233
 
217
- if (!hasGetOwnPropertySymbols) return keys;
234
+ if (!hasGetOwnPropertySymbols) {
235
+ return keys;
236
+ }
237
+
218
238
  var symbols = Object.getOwnPropertySymbols(object);
219
- if (!symbols.length) return keys;
239
+
240
+ if (!symbols.length) {
241
+ return keys;
242
+ }
243
+
220
244
  return [].concat(keys, symbols.filter(function (s) {
221
245
  return objectPrototype.propertyIsEnumerable.call(object, s);
222
246
  }));
@@ -229,8 +253,14 @@ var ownKeys = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKey
229
253
  /* istanbul ignore next */
230
254
  Object.getOwnPropertyNames;
231
255
  function stringifyKey(key) {
232
- if (typeof key === "string") return key;
233
- if (typeof key === "symbol") return key.toString();
256
+ if (typeof key === "string") {
257
+ return key;
258
+ }
259
+
260
+ if (typeof key === "symbol") {
261
+ return key.toString();
262
+ }
263
+
234
264
  return new String(key).toString();
235
265
  }
236
266
  function toPrimitive(value) {
@@ -518,7 +548,10 @@ function shallowComparer(a, b) {
518
548
  }
519
549
 
520
550
  function defaultComparer(a, b) {
521
- if (Object.is) return Object.is(a, b);
551
+ if (Object.is) {
552
+ return Object.is(a, b);
553
+ }
554
+
522
555
  return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
523
556
  }
524
557
 
@@ -531,20 +564,34 @@ var comparer = {
531
564
 
532
565
  function deepEnhancer(v, _, name) {
533
566
  // it is an observable already, done
534
- if (isObservable(v)) return v; // something that can be converted and mutated?
567
+ if (isObservable(v)) {
568
+ return v;
569
+ } // something that can be converted and mutated?
535
570
 
536
- if (Array.isArray(v)) return observable.array(v, {
537
- name: name
538
- });
539
- if (isPlainObject(v)) return observable.object(v, undefined, {
540
- name: name
541
- });
542
- if (isES6Map(v)) return observable.map(v, {
543
- name: name
544
- });
545
- if (isES6Set(v)) return observable.set(v, {
546
- name: name
547
- });
571
+
572
+ if (Array.isArray(v)) {
573
+ return observable.array(v, {
574
+ name: name
575
+ });
576
+ }
577
+
578
+ if (isPlainObject(v)) {
579
+ return observable.object(v, undefined, {
580
+ name: name
581
+ });
582
+ }
583
+
584
+ if (isES6Map(v)) {
585
+ return observable.map(v, {
586
+ name: name
587
+ });
588
+ }
589
+
590
+ if (isES6Set(v)) {
591
+ return observable.set(v, {
592
+ name: name
593
+ });
594
+ }
548
595
 
549
596
  if (typeof v === "function" && !isAction(v) && !isFlow(v)) {
550
597
  if (isGenerator(v)) {
@@ -557,33 +604,59 @@ function deepEnhancer(v, _, name) {
557
604
  return v;
558
605
  }
559
606
  function shallowEnhancer(v, _, name) {
560
- if (v === undefined || v === null) return v;
561
- if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) return v;
562
- if (Array.isArray(v)) return observable.array(v, {
563
- name: name,
564
- deep: false
565
- });
566
- if (isPlainObject(v)) return observable.object(v, undefined, {
567
- name: name,
568
- deep: false
569
- });
570
- if (isES6Map(v)) return observable.map(v, {
571
- name: name,
572
- deep: false
573
- });
574
- if (isES6Set(v)) return observable.set(v, {
575
- name: name,
576
- deep: false
577
- });
578
- die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
607
+ if (v === undefined || v === null) {
608
+ return v;
609
+ }
610
+
611
+ if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {
612
+ return v;
613
+ }
614
+
615
+ if (Array.isArray(v)) {
616
+ return observable.array(v, {
617
+ name: name,
618
+ deep: false
619
+ });
620
+ }
621
+
622
+ if (isPlainObject(v)) {
623
+ return observable.object(v, undefined, {
624
+ name: name,
625
+ deep: false
626
+ });
627
+ }
628
+
629
+ if (isES6Map(v)) {
630
+ return observable.map(v, {
631
+ name: name,
632
+ deep: false
633
+ });
634
+ }
635
+
636
+ if (isES6Set(v)) {
637
+ return observable.set(v, {
638
+ name: name,
639
+ deep: false
640
+ });
641
+ }
642
+
643
+ {
644
+ die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
645
+ }
579
646
  }
580
647
  function referenceEnhancer(newValue) {
581
648
  // never turn into an observable
582
649
  return newValue;
583
650
  }
584
651
  function refStructEnhancer(v, oldValue) {
585
- if ( isObservable(v)) die("observable.struct should not be used with observable values");
586
- if (deepEqual(v, oldValue)) return oldValue;
652
+ if ( isObservable(v)) {
653
+ die("observable.struct should not be used with observable values");
654
+ }
655
+
656
+ if (deepEqual(v, oldValue)) {
657
+ return oldValue;
658
+ }
659
+
587
660
  return v;
588
661
  }
589
662
 
@@ -732,9 +805,11 @@ function make_$2(adm, key, descriptor, source) {
732
805
 
733
806
 
734
807
  if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
735
- if (this.extend_(adm, key, descriptor, false) === null) return 0
736
- /* Cancel */
737
- ;
808
+ if (this.extend_(adm, key, descriptor, false) === null) {
809
+ return 0
810
+ /* Cancel */
811
+ ;
812
+ }
738
813
  }
739
814
 
740
815
  if (isFlow(descriptor.value)) {
@@ -1025,17 +1100,35 @@ function createObservable(v, arg2, arg3) {
1025
1100
  } // already observable - ignore
1026
1101
 
1027
1102
 
1028
- if (isObservable(v)) return v; // plain object
1103
+ if (isObservable(v)) {
1104
+ return v;
1105
+ } // plain object
1106
+
1107
+
1108
+ if (isPlainObject(v)) {
1109
+ return observable.object(v, arg2, arg3);
1110
+ } // Array
1111
+
1112
+
1113
+ if (Array.isArray(v)) {
1114
+ return observable.array(v, arg2);
1115
+ } // Map
1116
+
1029
1117
 
1030
- if (isPlainObject(v)) return observable.object(v, arg2, arg3); // Array
1118
+ if (isES6Map(v)) {
1119
+ return observable.map(v, arg2);
1120
+ } // Set
1031
1121
 
1032
- if (Array.isArray(v)) return observable.array(v, arg2); // Map
1033
1122
 
1034
- if (isES6Map(v)) return observable.map(v, arg2); // Set
1123
+ if (isES6Set(v)) {
1124
+ return observable.set(v, arg2);
1125
+ } // other object - ignore
1035
1126
 
1036
- if (isES6Set(v)) return observable.set(v, arg2); // other object - ignore
1037
1127
 
1038
- if (typeof v === "object" && v !== null) return v; // anything else
1128
+ if (typeof v === "object" && v !== null) {
1129
+ return v;
1130
+ } // anything else
1131
+
1039
1132
 
1040
1133
  return observable.box(v, arg2);
1041
1134
  }
@@ -1093,8 +1186,13 @@ var computed = function computed(arg1, arg2) {
1093
1186
 
1094
1187
 
1095
1188
  {
1096
- if (!isFunction(arg1)) die("First argument to `computed` should be an expression.");
1097
- if (isFunction(arg2)) die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1189
+ if (!isFunction(arg1)) {
1190
+ die("First argument to `computed` should be an expression.");
1191
+ }
1192
+
1193
+ if (isFunction(arg2)) {
1194
+ die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1195
+ }
1098
1196
  }
1099
1197
 
1100
1198
  var opts = isPlainObject(arg2) ? arg2 : {};
@@ -1126,8 +1224,13 @@ function createAction(actionName, fn, autoAction, ref) {
1126
1224
  }
1127
1225
 
1128
1226
  {
1129
- if (!isFunction(fn)) die("`action` can only be invoked on functions");
1130
- if (typeof actionName !== "string" || !actionName) die("actions should have valid names, got: '" + actionName + "'");
1227
+ if (!isFunction(fn)) {
1228
+ die("`action` can only be invoked on functions");
1229
+ }
1230
+
1231
+ if (typeof actionName !== "string" || !actionName) {
1232
+ die("actions should have valid names, got: '" + actionName + "'");
1233
+ }
1131
1234
  }
1132
1235
 
1133
1236
  function res() {
@@ -1209,7 +1312,10 @@ function _endAction(runInfo) {
1209
1312
  allowStateChangesEnd(runInfo.prevAllowStateChanges_);
1210
1313
  allowStateReadsEnd(runInfo.prevAllowStateReads_);
1211
1314
  endBatch();
1212
- if (runInfo.runAsAction_) untrackedEnd(runInfo.prevDerivation_);
1315
+
1316
+ if (runInfo.runAsAction_) {
1317
+ untrackedEnd(runInfo.prevDerivation_);
1318
+ }
1213
1319
 
1214
1320
  if ( runInfo.notifySpy_) {
1215
1321
  spyReportEnd({
@@ -1289,7 +1395,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1289
1395
  var _proto = ObservableValue.prototype;
1290
1396
 
1291
1397
  _proto.dehanceValue = function dehanceValue(value) {
1292
- if (this.dehancer !== undefined) return this.dehancer(value);
1398
+ if (this.dehancer !== undefined) {
1399
+ return this.dehancer(value);
1400
+ }
1401
+
1293
1402
  return value;
1294
1403
  };
1295
1404
 
@@ -1312,7 +1421,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1312
1421
  }
1313
1422
 
1314
1423
  this.setNewValue_(newValue);
1315
- if ( notifySpy) spyReportEnd();
1424
+
1425
+ if ( notifySpy) {
1426
+ spyReportEnd();
1427
+ }
1316
1428
  }
1317
1429
  };
1318
1430
 
@@ -1325,7 +1437,11 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1325
1437
  type: UPDATE,
1326
1438
  newValue: newValue
1327
1439
  });
1328
- if (!change) return globalState.UNCHANGED;
1440
+
1441
+ if (!change) {
1442
+ return globalState.UNCHANGED;
1443
+ }
1444
+
1329
1445
  newValue = change.newValue;
1330
1446
  } // apply modifier
1331
1447
 
@@ -1359,14 +1475,17 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1359
1475
  };
1360
1476
 
1361
1477
  _proto.observe_ = function observe_(listener, fireImmediately) {
1362
- if (fireImmediately) listener({
1363
- observableKind: "value",
1364
- debugObjectName: this.name_,
1365
- object: this,
1366
- type: UPDATE,
1367
- newValue: this.value_,
1368
- oldValue: undefined
1369
- });
1478
+ if (fireImmediately) {
1479
+ listener({
1480
+ observableKind: "value",
1481
+ debugObjectName: this.name_,
1482
+ object: this,
1483
+ type: UPDATE,
1484
+ newValue: this.value_,
1485
+ oldValue: undefined
1486
+ });
1487
+ }
1488
+
1370
1489
  return registerListener(this, listener);
1371
1490
  };
1372
1491
 
@@ -1461,7 +1580,11 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1461
1580
  this.keepAlive_ = void 0;
1462
1581
  this.onBOL = void 0;
1463
1582
  this.onBUOL = void 0;
1464
- if (!options.get) die(31);
1583
+
1584
+ if (!options.get) {
1585
+ die(31);
1586
+ }
1587
+
1465
1588
  this.derivation = options.get;
1466
1589
  this.name_ = options.name || ( "ComputedValue@" + getNextId() );
1467
1590
 
@@ -1503,7 +1626,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1503
1626
  ;
1504
1627
 
1505
1628
  _proto.get = function get() {
1506
- if (this.isComputing_) die(32, this.name_, this.derivation);
1629
+ if (this.isComputing_) {
1630
+ die(32, this.name_, this.derivation);
1631
+ }
1507
1632
 
1508
1633
  if (globalState.inBatch === 0 && // !globalState.trackingDerivatpion &&
1509
1634
  this.observers_.size === 0 && !this.keepAlive_) {
@@ -1519,20 +1644,34 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1519
1644
 
1520
1645
  if (shouldCompute(this)) {
1521
1646
  var prevTrackingContext = globalState.trackingContext;
1522
- if (this.keepAlive_ && !prevTrackingContext) globalState.trackingContext = this;
1523
- if (this.trackAndCompute()) propagateChangeConfirmed(this);
1647
+
1648
+ if (this.keepAlive_ && !prevTrackingContext) {
1649
+ globalState.trackingContext = this;
1650
+ }
1651
+
1652
+ if (this.trackAndCompute()) {
1653
+ propagateChangeConfirmed(this);
1654
+ }
1655
+
1524
1656
  globalState.trackingContext = prevTrackingContext;
1525
1657
  }
1526
1658
  }
1527
1659
 
1528
1660
  var result = this.value_;
1529
- if (isCaughtException(result)) throw result.cause;
1661
+
1662
+ if (isCaughtException(result)) {
1663
+ throw result.cause;
1664
+ }
1665
+
1530
1666
  return result;
1531
1667
  };
1532
1668
 
1533
1669
  _proto.set = function set(value) {
1534
1670
  if (this.setter_) {
1535
- if (this.isRunningSetter_) die(33, this.name_);
1671
+ if (this.isRunningSetter_) {
1672
+ die(33, this.name_);
1673
+ }
1674
+
1536
1675
  this.isRunningSetter_ = true;
1537
1676
 
1538
1677
  try {
@@ -1540,7 +1679,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1540
1679
  } finally {
1541
1680
  this.isRunningSetter_ = false;
1542
1681
  }
1543
- } else die(34, this.name_);
1682
+ } else {
1683
+ die(34, this.name_);
1684
+ }
1544
1685
  };
1545
1686
 
1546
1687
  _proto.trackAndCompute = function trackAndCompute() {
@@ -1769,7 +1910,9 @@ function checkIfStateModificationsAreAllowed(atom) {
1769
1910
 
1770
1911
  var hasObservers = atom.observers_.size > 0; // Should not be possible to change observed state outside strict mode, except during initialization, see #563
1771
1912
 
1772
- if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) console.warn("[MobX] " + (globalState.enforceActions ? "Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ") + atom.name_);
1913
+ if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) {
1914
+ console.warn("[MobX] " + (globalState.enforceActions ? "Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ") + atom.name_);
1915
+ }
1773
1916
  }
1774
1917
  function checkIfStateReadsAreAllowed(observable) {
1775
1918
  if ( !globalState.allowStateReads && globalState.observableRequiresReaction) {
@@ -1814,7 +1957,10 @@ function trackDerivedFunction(derivation, f, context) {
1814
1957
  }
1815
1958
 
1816
1959
  function warnAboutDerivationWithoutDependencies(derivation) {
1817
- if (derivation.observing_.length !== 0) return;
1960
+
1961
+ if (derivation.observing_.length !== 0) {
1962
+ return;
1963
+ }
1818
1964
 
1819
1965
  if (globalState.reactionRequiresObservable || derivation.requiresObservable_) {
1820
1966
  console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
@@ -1843,7 +1989,11 @@ function bindDependencies(derivation) {
1843
1989
 
1844
1990
  if (dep.diffValue_ === 0) {
1845
1991
  dep.diffValue_ = 1;
1846
- if (i0 !== i) observing[i0] = dep;
1992
+
1993
+ if (i0 !== i) {
1994
+ observing[i0] = dep;
1995
+ }
1996
+
1847
1997
  i0++;
1848
1998
  } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
1849
1999
  // not hitting the condition
@@ -1935,7 +2085,10 @@ function allowStateReadsEnd(prev) {
1935
2085
  */
1936
2086
 
1937
2087
  function changeDependenciesStateTo0(derivation) {
1938
- if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) return;
2088
+ if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
2089
+ return;
2090
+ }
2091
+
1939
2092
  derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;
1940
2093
  var obs = derivation.observing_;
1941
2094
  var i = obs.length;
@@ -1979,8 +2132,14 @@ var canMergeGlobalState = true;
1979
2132
  var isolateCalled = false;
1980
2133
  var globalState = /*#__PURE__*/function () {
1981
2134
  var global = /*#__PURE__*/getGlobal();
1982
- if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false;
1983
- if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) canMergeGlobalState = false;
2135
+
2136
+ if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {
2137
+ canMergeGlobalState = false;
2138
+ }
2139
+
2140
+ if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {
2141
+ canMergeGlobalState = false;
2142
+ }
1984
2143
 
1985
2144
  if (!canMergeGlobalState) {
1986
2145
  // Because this is a IIFE we need to let isolateCalled a chance to change
@@ -1993,7 +2152,11 @@ var globalState = /*#__PURE__*/function () {
1993
2152
  return new MobXGlobals();
1994
2153
  } else if (global.__mobxGlobals) {
1995
2154
  global.__mobxInstanceCount += 1;
1996
- if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
2155
+
2156
+ if (!global.__mobxGlobals.UNCHANGED) {
2157
+ global.__mobxGlobals.UNCHANGED = {};
2158
+ } // make merge backward compatible
2159
+
1997
2160
 
1998
2161
  return global.__mobxGlobals;
1999
2162
  } else {
@@ -2002,12 +2165,19 @@ var globalState = /*#__PURE__*/function () {
2002
2165
  }
2003
2166
  }();
2004
2167
  function isolateGlobalState() {
2005
- if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) die(36);
2168
+ if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {
2169
+ die(36);
2170
+ }
2171
+
2006
2172
  isolateCalled = true;
2007
2173
 
2008
2174
  if (canMergeGlobalState) {
2009
2175
  var global = getGlobal();
2010
- if (--global.__mobxInstanceCount === 0) global.__mobxGlobals = undefined;
2176
+
2177
+ if (--global.__mobxInstanceCount === 0) {
2178
+ global.__mobxGlobals = undefined;
2179
+ }
2180
+
2011
2181
  globalState = new MobXGlobals();
2012
2182
  }
2013
2183
  }
@@ -2023,7 +2193,9 @@ function resetGlobalState() {
2023
2193
  var defaultGlobals = new MobXGlobals();
2024
2194
 
2025
2195
  for (var key in defaultGlobals) {
2026
- if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];
2196
+ if (persistentKeys.indexOf(key) === -1) {
2197
+ globalState[key] = defaultGlobals[key];
2198
+ }
2027
2199
  }
2028
2200
 
2029
2201
  globalState.allowStateChanges = !globalState.enforceActions;
@@ -2057,8 +2229,12 @@ function addObserver(observable, node) {
2057
2229
  // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
2058
2230
  // invariantObservers(observable);
2059
2231
  observable.observers_.add(node);
2060
- if (observable.lowestObserverState_ > node.dependenciesState_) observable.lowestObserverState_ = node.dependenciesState_; // invariantObservers(observable);
2232
+
2233
+ if (observable.lowestObserverState_ > node.dependenciesState_) {
2234
+ observable.lowestObserverState_ = node.dependenciesState_;
2235
+ } // invariantObservers(observable);
2061
2236
  // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
2237
+
2062
2238
  }
2063
2239
  function removeObserver(observable, node) {
2064
2240
  // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
@@ -2169,7 +2345,10 @@ function reportObserved(observable) {
2169
2345
 
2170
2346
  function propagateChanged(observable) {
2171
2347
  // invariantLOS(observable, "changed start");
2172
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2348
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2349
+ return;
2350
+ }
2351
+
2173
2352
  observable.lowestObserverState_ = IDerivationState_.STALE_; // Ideally we use for..of here, but the downcompiled version is really slow...
2174
2353
 
2175
2354
  observable.observers_.forEach(function (d) {
@@ -2187,7 +2366,10 @@ function propagateChanged(observable) {
2187
2366
 
2188
2367
  function propagateChangeConfirmed(observable) {
2189
2368
  // invariantLOS(observable, "confirmed start");
2190
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2369
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2370
+ return;
2371
+ }
2372
+
2191
2373
  observable.lowestObserverState_ = IDerivationState_.STALE_;
2192
2374
  observable.observers_.forEach(function (d) {
2193
2375
  if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {
@@ -2205,7 +2387,10 @@ function propagateChangeConfirmed(observable) {
2205
2387
 
2206
2388
  function propagateMaybeChanged(observable) {
2207
2389
  // invariantLOS(observable, "maybe start");
2208
- if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) return;
2390
+ if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {
2391
+ return;
2392
+ }
2393
+
2209
2394
  observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;
2210
2395
  observable.observers_.forEach(function (d) {
2211
2396
  if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
@@ -2233,9 +2418,12 @@ function printDepTree(tree, lines, depth) {
2233
2418
  }
2234
2419
 
2235
2420
  lines.push("" + "\t".repeat(depth - 1) + tree.name);
2236
- if (tree.dependencies) tree.dependencies.forEach(function (child) {
2237
- return printDepTree(child, lines, depth + 1);
2238
- });
2421
+
2422
+ if (tree.dependencies) {
2423
+ tree.dependencies.forEach(function (child) {
2424
+ return printDepTree(child, lines, depth + 1);
2425
+ });
2426
+ }
2239
2427
  }
2240
2428
 
2241
2429
  var Reaction = /*#__PURE__*/function () {
@@ -2353,7 +2541,9 @@ var Reaction = /*#__PURE__*/function () {
2353
2541
  clearObserving(this);
2354
2542
  }
2355
2543
 
2356
- if (isCaughtException(result)) this.reportExceptionInDerivation_(result.cause);
2544
+ if (isCaughtException(result)) {
2545
+ this.reportExceptionInDerivation_(result.cause);
2546
+ }
2357
2547
 
2358
2548
  if ( notify) {
2359
2549
  spyReportEnd({
@@ -2372,13 +2562,18 @@ var Reaction = /*#__PURE__*/function () {
2372
2562
  return;
2373
2563
  }
2374
2564
 
2375
- if (globalState.disableErrorBoundaries) throw error;
2565
+ if (globalState.disableErrorBoundaries) {
2566
+ throw error;
2567
+ }
2568
+
2376
2569
  var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'" ;
2377
2570
 
2378
2571
  if (!globalState.suppressReactionErrors) {
2379
2572
  console.error(message, error);
2380
2573
  /** If debugging brought you here, please, read the above message :-). Tnx! */
2381
- } else console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)"); // prettier-ignore
2574
+ } else {
2575
+ console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)");
2576
+ } // prettier-ignore
2382
2577
 
2383
2578
 
2384
2579
  if ( isSpyEnabled()) {
@@ -2432,7 +2627,10 @@ function onReactionError(handler) {
2432
2627
  globalState.globalReactionErrorHandlers.push(handler);
2433
2628
  return function () {
2434
2629
  var idx = globalState.globalReactionErrorHandlers.indexOf(handler);
2435
- if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1);
2630
+
2631
+ if (idx >= 0) {
2632
+ globalState.globalReactionErrorHandlers.splice(idx, 1);
2633
+ }
2436
2634
  };
2437
2635
  }
2438
2636
  /**
@@ -2449,7 +2647,10 @@ var reactionScheduler = function reactionScheduler(f) {
2449
2647
 
2450
2648
  function runReactions() {
2451
2649
  // Trampolining, if runReactions are already running, new reactions will be picked up
2452
- if (globalState.inBatch > 0 || globalState.isRunningReactions) return;
2650
+ if (globalState.inBatch > 0 || globalState.isRunningReactions) {
2651
+ return;
2652
+ }
2653
+
2453
2654
  reactionScheduler(runReactionsHelper);
2454
2655
  }
2455
2656
 
@@ -2492,7 +2693,11 @@ function isSpyEnabled() {
2492
2693
  }
2493
2694
  function spyReport(event) {
2494
2695
 
2495
- if (!globalState.spyListeners.length) return;
2696
+
2697
+ if (!globalState.spyListeners.length) {
2698
+ return;
2699
+ }
2700
+
2496
2701
  var listeners = globalState.spyListeners;
2497
2702
 
2498
2703
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -2512,10 +2717,15 @@ var END_EVENT = {
2512
2717
  spyReportEnd: true
2513
2718
  };
2514
2719
  function spyReportEnd(change) {
2515
- if (change) spyReport(_extends({}, change, {
2516
- type: "report-end",
2517
- spyReportEnd: true
2518
- }));else spyReport(END_EVENT);
2720
+
2721
+ if (change) {
2722
+ spyReport(_extends({}, change, {
2723
+ type: "report-end",
2724
+ spyReportEnd: true
2725
+ }));
2726
+ } else {
2727
+ spyReport(END_EVENT);
2728
+ }
2519
2729
  }
2520
2730
  function spy(listener) {
2521
2731
  {
@@ -2548,9 +2758,15 @@ var autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_B
2548
2758
  function createActionFactory(autoAction) {
2549
2759
  var res = function action(arg1, arg2) {
2550
2760
  // action(fn() {})
2551
- if (isFunction(arg1)) return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction); // action("name", fn() {})
2761
+ if (isFunction(arg1)) {
2762
+ return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);
2763
+ } // action("name", fn() {})
2764
+
2765
+
2766
+ if (isFunction(arg2)) {
2767
+ return createAction(arg1, arg2, autoAction);
2768
+ } // @action
2552
2769
 
2553
- if (isFunction(arg2)) return createAction(arg1, arg2, autoAction); // @action
2554
2770
 
2555
2771
  if (isStringish(arg2)) {
2556
2772
  return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
@@ -2564,7 +2780,9 @@ function createActionFactory(autoAction) {
2564
2780
  }));
2565
2781
  }
2566
2782
 
2567
- die("Invalid arguments for `action`");
2783
+ {
2784
+ die("Invalid arguments for `action`");
2785
+ }
2568
2786
  };
2569
2787
 
2570
2788
  return res;
@@ -2598,8 +2816,13 @@ function autorun(view, opts) {
2598
2816
  }
2599
2817
 
2600
2818
  {
2601
- if (!isFunction(view)) die("Autorun expects a function as first argument");
2602
- if (isAction(view)) die("Autorun does not accept actions since actions are untrackable");
2819
+ if (!isFunction(view)) {
2820
+ die("Autorun expects a function as first argument");
2821
+ }
2822
+
2823
+ if (isAction(view)) {
2824
+ die("Autorun does not accept actions since actions are untrackable");
2825
+ }
2603
2826
  }
2604
2827
 
2605
2828
  var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : view.name || "Autorun@" + getNextId() ;
@@ -2620,7 +2843,10 @@ function autorun(view, opts) {
2620
2843
  isScheduled = true;
2621
2844
  scheduler(function () {
2622
2845
  isScheduled = false;
2623
- if (!reaction.isDisposed_) reaction.track(reactionRunner);
2846
+
2847
+ if (!reaction.isDisposed_) {
2848
+ reaction.track(reactionRunner);
2849
+ }
2624
2850
  });
2625
2851
  }
2626
2852
  }, opts.onError, opts.requiresObservable);
@@ -2652,8 +2878,13 @@ function reaction(expression, effect, opts) {
2652
2878
  }
2653
2879
 
2654
2880
  {
2655
- if (!isFunction(expression) || !isFunction(effect)) die("First and second argument to reaction should be functions");
2656
- if (!isPlainObject(opts)) die("Third argument of reactions should be an object");
2881
+ if (!isFunction(expression) || !isFunction(effect)) {
2882
+ die("First and second argument to reaction should be functions");
2883
+ }
2884
+
2885
+ if (!isPlainObject(opts)) {
2886
+ die("Third argument of reactions should be an object");
2887
+ }
2657
2888
  }
2658
2889
 
2659
2890
  var name = (_opts$name2 = opts.name) != null ? _opts$name2 : "Reaction@" + getNextId() ;
@@ -2676,7 +2907,11 @@ function reaction(expression, effect, opts) {
2676
2907
 
2677
2908
  function reactionRunner() {
2678
2909
  isScheduled = false;
2679
- if (r.isDisposed_) return;
2910
+
2911
+ if (r.isDisposed_) {
2912
+ return;
2913
+ }
2914
+
2680
2915
  var changed = false;
2681
2916
  r.track(function () {
2682
2917
  var nextValue = allowStateChanges(false, function () {
@@ -2686,7 +2921,13 @@ function reaction(expression, effect, opts) {
2686
2921
  oldValue = value;
2687
2922
  value = nextValue;
2688
2923
  });
2689
- if (firstTime && opts.fireImmediately) effectAction(value, oldValue, r);else if (!firstTime && changed) effectAction(value, oldValue, r);
2924
+
2925
+ if (firstTime && opts.fireImmediately) {
2926
+ effectAction(value, oldValue, r);
2927
+ } else if (!firstTime && changed) {
2928
+ effectAction(value, oldValue, r);
2929
+ }
2930
+
2690
2931
  firstTime = false;
2691
2932
  }
2692
2933
 
@@ -2753,7 +2994,9 @@ function configure(options) {
2753
2994
  globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== "undefined";
2754
2995
  }
2755
2996
 
2756
- if (useProxies === "ifavailable") globalState.verifyProxies = true;
2997
+ if (useProxies === "ifavailable") {
2998
+ globalState.verifyProxies = true;
2999
+ }
2757
3000
 
2758
3001
  if (enforceActions !== undefined) {
2759
3002
  var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;
@@ -2761,7 +3004,9 @@ function configure(options) {
2761
3004
  globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;
2762
3005
  }
2763
3006
  ["computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "disableErrorBoundaries", "safeDescriptors"].forEach(function (key) {
2764
- if (key in options) globalState[key] = !!options[key];
3007
+ if (key in options) {
3008
+ globalState[key] = !!options[key];
3009
+ }
2765
3010
  });
2766
3011
  globalState.allowStateReads = !globalState.observableRequiresReaction;
2767
3012
 
@@ -2776,11 +3021,25 @@ function configure(options) {
2776
3021
 
2777
3022
  function extendObservable(target, properties, annotations, options) {
2778
3023
  {
2779
- if (arguments.length > 4) die("'extendObservable' expected 2-4 arguments");
2780
- if (typeof target !== "object") die("'extendObservable' expects an object as first argument");
2781
- if (isObservableMap(target)) die("'extendObservable' should not be used on maps, use map.merge instead");
2782
- if (!isPlainObject(properties)) die("'extendObservable' only accepts plain objects as second argument");
2783
- if (isObservable(properties) || isObservable(annotations)) die("Extending an object with another observable (object) is not supported");
3024
+ if (arguments.length > 4) {
3025
+ die("'extendObservable' expected 2-4 arguments");
3026
+ }
3027
+
3028
+ if (typeof target !== "object") {
3029
+ die("'extendObservable' expects an object as first argument");
3030
+ }
3031
+
3032
+ if (isObservableMap(target)) {
3033
+ die("'extendObservable' should not be used on maps, use map.merge instead");
3034
+ }
3035
+
3036
+ if (!isPlainObject(properties)) {
3037
+ die("'extendObservable' only accepts plain objects as second argument");
3038
+ }
3039
+
3040
+ if (isObservable(properties) || isObservable(annotations)) {
3041
+ die("Extending an object with another observable (object) is not supported");
3042
+ }
2784
3043
  } // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)
2785
3044
 
2786
3045
 
@@ -2808,7 +3067,11 @@ function nodeToDependencyTree(node) {
2808
3067
  var result = {
2809
3068
  name: node.name_
2810
3069
  };
2811
- if (node.observing_ && node.observing_.length > 0) result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3070
+
3071
+ if (node.observing_ && node.observing_.length > 0) {
3072
+ result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3073
+ }
3074
+
2812
3075
  return result;
2813
3076
  }
2814
3077
 
@@ -2820,7 +3083,11 @@ function nodeToObserverTree(node) {
2820
3083
  var result = {
2821
3084
  name: node.name_
2822
3085
  };
2823
- if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3086
+
3087
+ if (hasObservers(node)) {
3088
+ result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3089
+ }
3090
+
2824
3091
  return result;
2825
3092
  }
2826
3093
 
@@ -2847,7 +3114,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2847
3114
  } // flow(fn)
2848
3115
 
2849
3116
 
2850
- if ( arguments.length !== 1) die("Flow expects single argument with generator function");
3117
+ if ( arguments.length !== 1) {
3118
+ die("Flow expects single argument with generator function");
3119
+ }
3120
+
2851
3121
  var generator = arg1;
2852
3122
  var name = generator.name || "<unnamed flow>"; // Implementation based on https://github.com/tj/co/blob/master/index.js
2853
3123
 
@@ -2895,7 +3165,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2895
3165
  return;
2896
3166
  }
2897
3167
 
2898
- if (ret.done) return resolve(ret.value);
3168
+ if (ret.done) {
3169
+ return resolve(ret.value);
3170
+ }
3171
+
2899
3172
  pendingPromise = Promise.resolve(ret.value);
2900
3173
  return pendingPromise.then(onFulfilled, onRejected);
2901
3174
  }
@@ -2904,7 +3177,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2904
3177
  });
2905
3178
  promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
2906
3179
  try {
2907
- if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff..
3180
+ if (pendingPromise) {
3181
+ cancelPromise(pendingPromise);
3182
+ } // Finally block can return (or yield) stuff..
3183
+
2908
3184
 
2909
3185
  var _res = gen["return"](undefined); // eat anything that promise would do, it's cancelled!
2910
3186
 
@@ -2928,7 +3204,9 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2928
3204
  flow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);
2929
3205
 
2930
3206
  function cancelPromise(promise) {
2931
- if (isFunction(promise.cancel)) promise.cancel();
3207
+ if (isFunction(promise.cancel)) {
3208
+ promise.cancel();
3209
+ }
2932
3210
  }
2933
3211
 
2934
3212
  function flowResult(result) {
@@ -2944,13 +3222,19 @@ function interceptReads(thing, propOrHandler, handler) {
2944
3222
  if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {
2945
3223
  target = getAdministration(thing);
2946
3224
  } else if (isObservableObject(thing)) {
2947
- if ( !isStringish(propOrHandler)) return die("InterceptReads can only be used with a specific property, not with an object in general");
3225
+ if ( !isStringish(propOrHandler)) {
3226
+ return die("InterceptReads can only be used with a specific property, not with an object in general");
3227
+ }
3228
+
2948
3229
  target = getAdministration(thing, propOrHandler);
2949
3230
  } else {
2950
3231
  return die("Expected observable map, object or array as first array");
2951
3232
  }
2952
3233
 
2953
- if ( target.dehancer !== undefined) return die("An intercept reader was already established");
3234
+ if ( target.dehancer !== undefined) {
3235
+ return die("An intercept reader was already established");
3236
+ }
3237
+
2954
3238
  target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
2955
3239
  return function () {
2956
3240
  target.dehancer = undefined;
@@ -2958,7 +3242,11 @@ function interceptReads(thing, propOrHandler, handler) {
2958
3242
  }
2959
3243
 
2960
3244
  function intercept(thing, propOrHandler, handler) {
2961
- if (isFunction(handler)) return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler);
3245
+ if (isFunction(handler)) {
3246
+ return interceptProperty(thing, propOrHandler, handler);
3247
+ } else {
3248
+ return interceptInterceptable(thing, propOrHandler);
3249
+ }
2962
3250
  }
2963
3251
 
2964
3252
  function interceptInterceptable(thing, handler) {
@@ -2974,25 +3262,41 @@ function _isComputed(value, property) {
2974
3262
  return isComputedValue(value);
2975
3263
  }
2976
3264
 
2977
- if (isObservableObject(value) === false) return false;
2978
- if (!value[$mobx].values_.has(property)) return false;
3265
+ if (isObservableObject(value) === false) {
3266
+ return false;
3267
+ }
3268
+
3269
+ if (!value[$mobx].values_.has(property)) {
3270
+ return false;
3271
+ }
3272
+
2979
3273
  var atom = getAtom(value, property);
2980
3274
  return isComputedValue(atom);
2981
3275
  }
2982
3276
  function isComputed(value) {
2983
- if ( arguments.length > 1) return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3277
+ if ( arguments.length > 1) {
3278
+ return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3279
+ }
3280
+
2984
3281
  return _isComputed(value);
2985
3282
  }
2986
3283
  function isComputedProp(value, propName) {
2987
- if ( !isStringish(propName)) return die("isComputed expected a property name as second argument");
3284
+ if ( !isStringish(propName)) {
3285
+ return die("isComputed expected a property name as second argument");
3286
+ }
3287
+
2988
3288
  return _isComputed(value, propName);
2989
3289
  }
2990
3290
 
2991
3291
  function _isObservable(value, property) {
2992
- if (!value) return false;
3292
+ if (!value) {
3293
+ return false;
3294
+ }
2993
3295
 
2994
3296
  if (property !== undefined) {
2995
- if ( (isObservableMap(value) || isObservableArray(value))) return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3297
+ if ( (isObservableMap(value) || isObservableArray(value))) {
3298
+ return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3299
+ }
2996
3300
 
2997
3301
  if (isObservableObject(value)) {
2998
3302
  return value[$mobx].values_.has(property);
@@ -3006,11 +3310,17 @@ function _isObservable(value, property) {
3006
3310
  }
3007
3311
 
3008
3312
  function isObservable(value) {
3009
- if ( arguments.length !== 1) die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3313
+ if ( arguments.length !== 1) {
3314
+ die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3315
+ }
3316
+
3010
3317
  return _isObservable(value);
3011
3318
  }
3012
3319
  function isObservableProp(value, propName) {
3013
- if ( !isStringish(propName)) return die("expected a property name as second argument");
3320
+ if ( !isStringish(propName)) {
3321
+ return die("expected a property name as second argument");
3322
+ }
3323
+
3014
3324
  return _isObservable(value, propName);
3015
3325
  }
3016
3326
 
@@ -3102,13 +3412,25 @@ function set(obj, key, value) {
3102
3412
  } else if (isObservableSet(obj)) {
3103
3413
  obj.add(key);
3104
3414
  } else if (isObservableArray(obj)) {
3105
- if (typeof key !== "number") key = parseInt(key, 10);
3106
- if (key < 0) die("Invalid index: '" + key + "'");
3415
+ if (typeof key !== "number") {
3416
+ key = parseInt(key, 10);
3417
+ }
3418
+
3419
+ if (key < 0) {
3420
+ die("Invalid index: '" + key + "'");
3421
+ }
3422
+
3107
3423
  startBatch();
3108
- if (key >= obj.length) obj.length = key + 1;
3424
+
3425
+ if (key >= obj.length) {
3426
+ obj.length = key + 1;
3427
+ }
3428
+
3109
3429
  obj[key] = value;
3110
3430
  endBatch();
3111
- } else die(8);
3431
+ } else {
3432
+ die(8);
3433
+ }
3112
3434
  }
3113
3435
  function remove(obj, key) {
3114
3436
  if (isObservableObject(obj)) {
@@ -3118,7 +3440,10 @@ function remove(obj, key) {
3118
3440
  } else if (isObservableSet(obj)) {
3119
3441
  obj["delete"](key);
3120
3442
  } else if (isObservableArray(obj)) {
3121
- if (typeof key !== "number") key = parseInt(key, 10);
3443
+ if (typeof key !== "number") {
3444
+ key = parseInt(key, 10);
3445
+ }
3446
+
3122
3447
  obj.splice(key, 1);
3123
3448
  } else {
3124
3449
  die(9);
@@ -3138,7 +3463,9 @@ function has(obj, key) {
3138
3463
  die(10);
3139
3464
  }
3140
3465
  function get(obj, key) {
3141
- if (!has(obj, key)) return undefined;
3466
+ if (!has(obj, key)) {
3467
+ return undefined;
3468
+ }
3142
3469
 
3143
3470
  if (isObservableObject(obj)) {
3144
3471
  return obj[$mobx].get_(key);
@@ -3166,7 +3493,11 @@ function apiOwnKeys(obj) {
3166
3493
  }
3167
3494
 
3168
3495
  function observe(thing, propOrCb, cbOrFire, fireImmediately) {
3169
- if (isFunction(cbOrFire)) return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire);
3496
+ if (isFunction(cbOrFire)) {
3497
+ return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
3498
+ } else {
3499
+ return observeObservable(thing, propOrCb, cbOrFire);
3500
+ }
3170
3501
  }
3171
3502
 
3172
3503
  function observeObservable(thing, listener, fireImmediately) {
@@ -3183,8 +3514,13 @@ function cache(map, key, value) {
3183
3514
  }
3184
3515
 
3185
3516
  function toJSHelper(source, __alreadySeen) {
3186
- if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) return source;
3187
- if (isObservableValue(source) || isComputedValue(source)) return toJSHelper(source.get(), __alreadySeen);
3517
+ if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) {
3518
+ return source;
3519
+ }
3520
+
3521
+ if (isObservableValue(source) || isComputedValue(source)) {
3522
+ return toJSHelper(source.get(), __alreadySeen);
3523
+ }
3188
3524
 
3189
3525
  if (__alreadySeen.has(source)) {
3190
3526
  return __alreadySeen.get(source);
@@ -3235,18 +3571,25 @@ function toJSHelper(source, __alreadySeen) {
3235
3571
 
3236
3572
 
3237
3573
  function toJS(source, options) {
3238
- if ( options) die("toJS no longer supports options");
3574
+ if ( options) {
3575
+ die("toJS no longer supports options");
3576
+ }
3577
+
3239
3578
  return toJSHelper(source, new Map());
3240
3579
  }
3241
3580
 
3242
3581
  function trace() {
3582
+
3243
3583
  var enterBreakPoint = false;
3244
3584
 
3245
3585
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3246
3586
  args[_key] = arguments[_key];
3247
3587
  }
3248
3588
 
3249
- if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop();
3589
+ if (typeof args[args.length - 1] === "boolean") {
3590
+ enterBreakPoint = args.pop();
3591
+ }
3592
+
3250
3593
  var derivation = getAtomFromArgs(args);
3251
3594
 
3252
3595
  if (!derivation) {
@@ -3296,7 +3639,10 @@ function transaction(action, thisArg) {
3296
3639
  }
3297
3640
 
3298
3641
  function when(predicate, arg1, arg2) {
3299
- if (arguments.length === 1 || arg1 && typeof arg1 === "object") return whenPromise(predicate, arg1);
3642
+ if (arguments.length === 1 || arg1 && typeof arg1 === "object") {
3643
+ return whenPromise(predicate, arg1);
3644
+ }
3645
+
3300
3646
  return _when(predicate, arg1, arg2 || {});
3301
3647
  }
3302
3648
 
@@ -3308,7 +3654,12 @@ function _when(predicate, effect, opts) {
3308
3654
  timeoutHandle = setTimeout(function () {
3309
3655
  if (!disposer[$mobx].isDisposed_) {
3310
3656
  disposer();
3311
- if (opts.onError) opts.onError(error);else throw error;
3657
+
3658
+ if (opts.onError) {
3659
+ opts.onError(error);
3660
+ } else {
3661
+ throw error;
3662
+ }
3312
3663
  }
3313
3664
  }, opts.timeout);
3314
3665
  }
@@ -3322,7 +3673,11 @@ function _when(predicate, effect, opts) {
3322
3673
 
3323
3674
  if (cond) {
3324
3675
  r.dispose();
3325
- if (timeoutHandle) clearTimeout(timeoutHandle);
3676
+
3677
+ if (timeoutHandle) {
3678
+ clearTimeout(timeoutHandle);
3679
+ }
3680
+
3326
3681
  effectAction();
3327
3682
  }
3328
3683
  }, opts);
@@ -3330,7 +3685,10 @@ function _when(predicate, effect, opts) {
3330
3685
  }
3331
3686
 
3332
3687
  function whenPromise(predicate, opts) {
3333
- if ( opts && opts.onError) return die("the options 'onError' and 'promise' cannot be combined");
3688
+ if ( opts && opts.onError) {
3689
+ return die("the options 'onError' and 'promise' cannot be combined");
3690
+ }
3691
+
3334
3692
  var cancel;
3335
3693
  var res = new Promise(function (resolve, reject) {
3336
3694
  var disposer = _when(predicate, resolve, _extends({}, opts, {
@@ -3354,7 +3712,10 @@ function getAdm(target) {
3354
3712
 
3355
3713
  var objectProxyTraps = {
3356
3714
  has: function has(target, name) {
3357
- if ( globalState.trackingDerivation) warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3715
+ if ( globalState.trackingDerivation) {
3716
+ warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3717
+ }
3718
+
3358
3719
  return getAdm(target).has_(name);
3359
3720
  },
3360
3721
  get: function get(target, name) {
@@ -3363,7 +3724,9 @@ var objectProxyTraps = {
3363
3724
  set: function set(target, name, value) {
3364
3725
  var _getAdm$set_;
3365
3726
 
3366
- if (!isStringish(name)) return false;
3727
+ if (!isStringish(name)) {
3728
+ return false;
3729
+ }
3367
3730
 
3368
3731
  if ( !getAdm(target).values_.has(name)) {
3369
3732
  warnAboutProxyRequirement("add a new observable property through direct assignment. Use 'set' from 'mobx' instead.");
@@ -3379,7 +3742,10 @@ var objectProxyTraps = {
3379
3742
  warnAboutProxyRequirement("delete properties from an observable object. Use 'remove' from 'mobx' instead.");
3380
3743
  }
3381
3744
 
3382
- if (!isStringish(name)) return false; // null (intercepted) -> true (success)
3745
+ if (!isStringish(name)) {
3746
+ return false;
3747
+ } // null (intercepted) -> true (success)
3748
+
3383
3749
 
3384
3750
  return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;
3385
3751
  },
@@ -3394,7 +3760,10 @@ var objectProxyTraps = {
3394
3760
  return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;
3395
3761
  },
3396
3762
  ownKeys: function ownKeys(target) {
3397
- if ( globalState.trackingDerivation) warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3763
+ if ( globalState.trackingDerivation) {
3764
+ warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3765
+ }
3766
+
3398
3767
  return getAdm(target).ownKeys_();
3399
3768
  },
3400
3769
  preventExtensions: function preventExtensions(target) {
@@ -3417,7 +3786,10 @@ function registerInterceptor(interceptable, handler) {
3417
3786
  interceptors.push(handler);
3418
3787
  return once(function () {
3419
3788
  var idx = interceptors.indexOf(handler);
3420
- if (idx !== -1) interceptors.splice(idx, 1);
3789
+
3790
+ if (idx !== -1) {
3791
+ interceptors.splice(idx, 1);
3792
+ }
3421
3793
  });
3422
3794
  }
3423
3795
  function interceptChange(interceptable, change) {
@@ -3429,8 +3801,14 @@ function interceptChange(interceptable, change) {
3429
3801
 
3430
3802
  for (var i = 0, l = interceptors.length; i < l; i++) {
3431
3803
  change = interceptors[i](change);
3432
- if (change && !change.type) die(14);
3433
- if (!change) break;
3804
+
3805
+ if (change && !change.type) {
3806
+ die(14);
3807
+ }
3808
+
3809
+ if (!change) {
3810
+ break;
3811
+ }
3434
3812
  }
3435
3813
 
3436
3814
  return change;
@@ -3447,13 +3825,20 @@ function registerListener(listenable, handler) {
3447
3825
  listeners.push(handler);
3448
3826
  return once(function () {
3449
3827
  var idx = listeners.indexOf(handler);
3450
- if (idx !== -1) listeners.splice(idx, 1);
3828
+
3829
+ if (idx !== -1) {
3830
+ listeners.splice(idx, 1);
3831
+ }
3451
3832
  });
3452
3833
  }
3453
3834
  function notifyListeners(listenable, change) {
3454
3835
  var prevU = untrackedStart();
3455
3836
  var listeners = listenable.changeListeners_;
3456
- if (!listeners) return;
3837
+
3838
+ if (!listeners) {
3839
+ return;
3840
+ }
3841
+
3457
3842
  listeners = listeners.slice();
3458
3843
 
3459
3844
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -3490,8 +3875,13 @@ function makeObservable(target, annotations, options) {
3490
3875
  var keysSymbol = /*#__PURE__*/Symbol("mobx-keys");
3491
3876
  function makeAutoObservable(target, overrides, options) {
3492
3877
  {
3493
- if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3494
- if (isObservableObject(target)) die("makeAutoObservable can only be used on objects not already made observable");
3878
+ if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {
3879
+ die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3880
+ }
3881
+
3882
+ if (isObservableObject(target)) {
3883
+ die("makeAutoObservable can only be used on objects not already made observable");
3884
+ }
3495
3885
  } // Optimization: avoid visiting protos
3496
3886
  // Assumes that annotation.make_/.extend_ works the same for plain objects
3497
3887
 
@@ -3532,8 +3922,14 @@ var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/8
3532
3922
  var arrayTraps = {
3533
3923
  get: function get(target, name) {
3534
3924
  var adm = target[$mobx];
3535
- if (name === $mobx) return adm;
3536
- if (name === "length") return adm.getArrayLength_();
3925
+
3926
+ if (name === $mobx) {
3927
+ return adm;
3928
+ }
3929
+
3930
+ if (name === "length") {
3931
+ return adm.getArrayLength_();
3932
+ }
3537
3933
 
3538
3934
  if (typeof name === "string" && !isNaN(name)) {
3539
3935
  return adm.get_(parseInt(name));
@@ -3594,12 +3990,18 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3594
3990
  var _proto = ObservableArrayAdministration.prototype;
3595
3991
 
3596
3992
  _proto.dehanceValue_ = function dehanceValue_(value) {
3597
- if (this.dehancer !== undefined) return this.dehancer(value);
3993
+ if (this.dehancer !== undefined) {
3994
+ return this.dehancer(value);
3995
+ }
3996
+
3598
3997
  return value;
3599
3998
  };
3600
3999
 
3601
4000
  _proto.dehanceValues_ = function dehanceValues_(values) {
3602
- if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer);
4001
+ if (this.dehancer !== undefined && values.length > 0) {
4002
+ return values.map(this.dehancer);
4003
+ }
4004
+
3603
4005
  return values;
3604
4006
  };
3605
4007
 
@@ -3635,9 +4037,15 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3635
4037
  };
3636
4038
 
3637
4039
  _proto.setArrayLength_ = function setArrayLength_(newLength) {
3638
- if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) die("Out of range: " + newLength);
4040
+ if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) {
4041
+ die("Out of range: " + newLength);
4042
+ }
4043
+
3639
4044
  var currentLength = this.values_.length;
3640
- if (newLength === currentLength) return;else if (newLength > currentLength) {
4045
+
4046
+ if (newLength === currentLength) {
4047
+ return;
4048
+ } else if (newLength > currentLength) {
3641
4049
  var newItems = new Array(newLength - currentLength);
3642
4050
 
3643
4051
  for (var i = 0; i < newLength - currentLength; i++) {
@@ -3646,13 +4054,21 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3646
4054
 
3647
4055
 
3648
4056
  this.spliceWithArray_(currentLength, 0, newItems);
3649
- } else this.spliceWithArray_(newLength, currentLength - newLength);
4057
+ } else {
4058
+ this.spliceWithArray_(newLength, currentLength - newLength);
4059
+ }
3650
4060
  };
3651
4061
 
3652
4062
  _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {
3653
- if (oldLength !== this.lastKnownLength_) die(16);
4063
+ if (oldLength !== this.lastKnownLength_) {
4064
+ die(16);
4065
+ }
4066
+
3654
4067
  this.lastKnownLength_ += delta;
3655
- if (this.legacyMode_ && delta > 0) reserveArrayBuffer(oldLength + delta + 1);
4068
+
4069
+ if (this.legacyMode_ && delta > 0) {
4070
+ reserveArrayBuffer(oldLength + delta + 1);
4071
+ }
3656
4072
  };
3657
4073
 
3658
4074
  _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {
@@ -3660,9 +4076,26 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3660
4076
 
3661
4077
  checkIfStateModificationsAreAllowed(this.atom_);
3662
4078
  var length = this.values_.length;
3663
- if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index);
3664
- if (arguments.length === 1) deleteCount = length - index;else if (deleteCount === undefined || deleteCount === null) deleteCount = 0;else deleteCount = Math.max(0, Math.min(deleteCount, length - index));
3665
- if (newItems === undefined) newItems = EMPTY_ARRAY;
4079
+
4080
+ if (index === undefined) {
4081
+ index = 0;
4082
+ } else if (index > length) {
4083
+ index = length;
4084
+ } else if (index < 0) {
4085
+ index = Math.max(0, length + index);
4086
+ }
4087
+
4088
+ if (arguments.length === 1) {
4089
+ deleteCount = length - index;
4090
+ } else if (deleteCount === undefined || deleteCount === null) {
4091
+ deleteCount = 0;
4092
+ } else {
4093
+ deleteCount = Math.max(0, Math.min(deleteCount, length - index));
4094
+ }
4095
+
4096
+ if (newItems === undefined) {
4097
+ newItems = EMPTY_ARRAY;
4098
+ }
3666
4099
 
3667
4100
  if (hasInterceptors(this)) {
3668
4101
  var change = interceptChange(this, {
@@ -3672,7 +4105,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3672
4105
  removedCount: deleteCount,
3673
4106
  added: newItems
3674
4107
  });
3675
- if (!change) return EMPTY_ARRAY;
4108
+
4109
+ if (!change) {
4110
+ return EMPTY_ARRAY;
4111
+ }
4112
+
3676
4113
  deleteCount = change.removedCount;
3677
4114
  newItems = change.added;
3678
4115
  }
@@ -3687,7 +4124,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3687
4124
  }
3688
4125
 
3689
4126
  var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
3690
- if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice_(index, newItems, res);
4127
+
4128
+ if (deleteCount !== 0 || newItems.length !== 0) {
4129
+ this.notifyArraySplice_(index, newItems, res);
4130
+ }
4131
+
3691
4132
  return this.dehanceValues_(res);
3692
4133
  };
3693
4134
 
@@ -3730,10 +4171,19 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3730
4171
  } : null; // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't
3731
4172
  // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
3732
4173
 
3733
- if ( notifySpy) spyReportStart(change);
4174
+ if ( notifySpy) {
4175
+ spyReportStart(change);
4176
+ }
4177
+
3734
4178
  this.atom_.reportChanged();
3735
- if (notify) notifyListeners(this, change);
3736
- if ( notifySpy) spyReportEnd();
4179
+
4180
+ if (notify) {
4181
+ notifyListeners(this, change);
4182
+ }
4183
+
4184
+ if ( notifySpy) {
4185
+ spyReportEnd();
4186
+ }
3737
4187
  };
3738
4188
 
3739
4189
  _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {
@@ -3750,11 +4200,20 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3750
4200
  removedCount: removed.length,
3751
4201
  addedCount: added.length
3752
4202
  } : null;
3753
- if ( notifySpy) spyReportStart(change);
4203
+
4204
+ if ( notifySpy) {
4205
+ spyReportStart(change);
4206
+ }
4207
+
3754
4208
  this.atom_.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
3755
4209
 
3756
- if (notify) notifyListeners(this, change);
3757
- if ( notifySpy) spyReportEnd();
4210
+ if (notify) {
4211
+ notifyListeners(this, change);
4212
+ }
4213
+
4214
+ if ( notifySpy) {
4215
+ spyReportEnd();
4216
+ }
3758
4217
  };
3759
4218
 
3760
4219
  _proto.get_ = function get_(index) {
@@ -3781,7 +4240,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3781
4240
  index: index,
3782
4241
  newValue: newValue
3783
4242
  });
3784
- if (!change) return;
4243
+
4244
+ if (!change) {
4245
+ return;
4246
+ }
4247
+
3785
4248
  newValue = change.newValue;
3786
4249
  }
3787
4250
 
@@ -4065,7 +4528,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4065
4528
  _proto.has = function has(key) {
4066
4529
  var _this2 = this;
4067
4530
 
4068
- if (!globalState.trackingDerivation) return this.has_(key);
4531
+ if (!globalState.trackingDerivation) {
4532
+ return this.has_(key);
4533
+ }
4534
+
4069
4535
  var entry = this.hasMap_.get(key);
4070
4536
 
4071
4537
  if (!entry) {
@@ -4089,7 +4555,11 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4089
4555
  newValue: value,
4090
4556
  name: key
4091
4557
  });
4092
- if (!change) return this;
4558
+
4559
+ if (!change) {
4560
+ return this;
4561
+ }
4562
+
4093
4563
  value = change.newValue;
4094
4564
  }
4095
4565
 
@@ -4113,7 +4583,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4113
4583
  object: this,
4114
4584
  name: key
4115
4585
  });
4116
- if (!change) return false;
4586
+
4587
+ if (!change) {
4588
+ return false;
4589
+ }
4117
4590
  }
4118
4591
 
4119
4592
  if (this.has_(key)) {
@@ -4129,7 +4602,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4129
4602
  name: key
4130
4603
  } : null;
4131
4604
 
4132
- if ( notifySpy) spyReportStart(_change); // TODO fix type
4605
+ if ( notifySpy) {
4606
+ spyReportStart(_change);
4607
+ } // TODO fix type
4608
+
4133
4609
 
4134
4610
  transaction(function () {
4135
4611
  var _this3$hasMap_$get;
@@ -4144,8 +4620,15 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4144
4620
 
4145
4621
  _this3.data_["delete"](key);
4146
4622
  });
4147
- if (notify) notifyListeners(this, _change);
4148
- if ( notifySpy) spyReportEnd();
4623
+
4624
+ if (notify) {
4625
+ notifyListeners(this, _change);
4626
+ }
4627
+
4628
+ if ( notifySpy) {
4629
+ spyReportEnd();
4630
+ }
4631
+
4149
4632
  return true;
4150
4633
  }
4151
4634
 
@@ -4168,11 +4651,21 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4168
4651
  name: key,
4169
4652
  newValue: newValue
4170
4653
  } : null;
4171
- if ( notifySpy) spyReportStart(change); // TODO fix type
4654
+
4655
+ if ( notifySpy) {
4656
+ spyReportStart(change);
4657
+ } // TODO fix type
4658
+
4172
4659
 
4173
4660
  observable.setNewValue_(newValue);
4174
- if (notify) notifyListeners(this, change);
4175
- if ( notifySpy) spyReportEnd();
4661
+
4662
+ if (notify) {
4663
+ notifyListeners(this, change);
4664
+ }
4665
+
4666
+ if ( notifySpy) {
4667
+ spyReportEnd();
4668
+ }
4176
4669
  }
4177
4670
  };
4178
4671
 
@@ -4203,14 +4696,26 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4203
4696
  name: key,
4204
4697
  newValue: newValue
4205
4698
  } : null;
4206
- if ( notifySpy) spyReportStart(change); // TODO fix type
4207
4699
 
4208
- if (notify) notifyListeners(this, change);
4209
- if ( notifySpy) spyReportEnd();
4700
+ if ( notifySpy) {
4701
+ spyReportStart(change);
4702
+ } // TODO fix type
4703
+
4704
+
4705
+ if (notify) {
4706
+ notifyListeners(this, change);
4707
+ }
4708
+
4709
+ if ( notifySpy) {
4710
+ spyReportEnd();
4711
+ }
4210
4712
  };
4211
4713
 
4212
4714
  _proto.get = function get(key) {
4213
- if (this.has(key)) return this.dehanceValue_(this.data_.get(key).get());
4715
+ if (this.has(key)) {
4716
+ return this.dehanceValue_(this.data_.get(key).get());
4717
+ }
4718
+
4214
4719
  return this.dehanceValue_(undefined);
4215
4720
  };
4216
4721
 
@@ -4284,18 +4789,27 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4284
4789
  }
4285
4790
 
4286
4791
  transaction(function () {
4287
- if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) {
4288
- return _this5.set(key, other[key]);
4289
- });else if (Array.isArray(other)) other.forEach(function (_ref) {
4290
- var key = _ref[0],
4291
- value = _ref[1];
4292
- return _this5.set(key, value);
4293
- });else if (isES6Map(other)) {
4294
- if (other.constructor !== Map) die(19, other);
4792
+ if (isPlainObject(other)) {
4793
+ getPlainObjectKeys(other).forEach(function (key) {
4794
+ return _this5.set(key, other[key]);
4795
+ });
4796
+ } else if (Array.isArray(other)) {
4797
+ other.forEach(function (_ref) {
4798
+ var key = _ref[0],
4799
+ value = _ref[1];
4800
+ return _this5.set(key, value);
4801
+ });
4802
+ } else if (isES6Map(other)) {
4803
+ if (other.constructor !== Map) {
4804
+ die(19, other);
4805
+ }
4806
+
4295
4807
  other.forEach(function (value, key) {
4296
4808
  return _this5.set(key, value);
4297
4809
  });
4298
- } else if (other !== null && other !== undefined) die(20, other);
4810
+ } else if (other !== null && other !== undefined) {
4811
+ die(20, other);
4812
+ }
4299
4813
  });
4300
4814
  return this;
4301
4815
  };
@@ -4426,7 +4940,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4426
4940
  * for callback details
4427
4941
  */
4428
4942
  _proto.observe_ = function observe_(listener, fireImmediately) {
4429
- if ( fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with maps.");
4943
+ if ( fireImmediately === true) {
4944
+ die("`observe` doesn't support fireImmediately=true in combination with maps.");
4945
+ }
4946
+
4430
4947
  return registerListener(this, listener);
4431
4948
  };
4432
4949
 
@@ -4551,8 +5068,12 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4551
5068
  object: this,
4552
5069
  newValue: value
4553
5070
  });
4554
- if (!change) return this; // ideally, value = change.value would be done here, so that values can be
5071
+
5072
+ if (!change) {
5073
+ return this;
5074
+ } // ideally, value = change.value would be done here, so that values can be
4555
5075
  // changed by interceptor. Same applies for other Set and Map api's.
5076
+
4556
5077
  }
4557
5078
 
4558
5079
  if (!this.has(value)) {
@@ -4572,9 +5093,17 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4572
5093
  newValue: value
4573
5094
  } : null;
4574
5095
 
4575
- if (notifySpy && "development" !== "production") spyReportStart(_change);
4576
- if (notify) notifyListeners(this, _change);
4577
- if (notifySpy && "development" !== "production") spyReportEnd();
5096
+ if (notifySpy && "development" !== "production") {
5097
+ spyReportStart(_change);
5098
+ }
5099
+
5100
+ if (notify) {
5101
+ notifyListeners(this, _change);
5102
+ }
5103
+
5104
+ if (notifySpy && "development" !== "production") {
5105
+ spyReportEnd();
5106
+ }
4578
5107
  }
4579
5108
 
4580
5109
  return this;
@@ -4589,7 +5118,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4589
5118
  object: this,
4590
5119
  oldValue: value
4591
5120
  });
4592
- if (!change) return false;
5121
+
5122
+ if (!change) {
5123
+ return false;
5124
+ }
4593
5125
  }
4594
5126
 
4595
5127
  if (this.has(value)) {
@@ -4604,14 +5136,24 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4604
5136
  oldValue: value
4605
5137
  } : null;
4606
5138
 
4607
- if (notifySpy && "development" !== "production") spyReportStart(_change2);
5139
+ if (notifySpy && "development" !== "production") {
5140
+ spyReportStart(_change2);
5141
+ }
5142
+
4608
5143
  transaction(function () {
4609
5144
  _this3.atom_.reportChanged();
4610
5145
 
4611
5146
  _this3.data_["delete"](value);
4612
5147
  });
4613
- if (notify) notifyListeners(this, _change2);
4614
- if (notifySpy && "development" !== "production") spyReportEnd();
5148
+
5149
+ if (notify) {
5150
+ notifyListeners(this, _change2);
5151
+ }
5152
+
5153
+ if (notifySpy && "development" !== "production") {
5154
+ spyReportEnd();
5155
+ }
5156
+
4615
5157
  return true;
4616
5158
  }
4617
5159
 
@@ -4691,7 +5233,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4691
5233
 
4692
5234
  _proto.observe_ = function observe_(listener, fireImmediately) {
4693
5235
  // ... 'fireImmediately' could also be true?
4694
- if ( fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with sets.");
5236
+ if ( fireImmediately === true) {
5237
+ die("`observe` doesn't support fireImmediately=true in combination with sets.");
5238
+ }
5239
+
4695
5240
  return registerListener(this, listener);
4696
5241
  };
4697
5242
 
@@ -4793,7 +5338,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4793
5338
  name: key,
4794
5339
  newValue: newValue
4795
5340
  });
4796
- if (!change) return null;
5341
+
5342
+ if (!change) {
5343
+ return null;
5344
+ }
5345
+
4797
5346
  newValue = change.newValue;
4798
5347
  }
4799
5348
 
@@ -4813,10 +5362,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4813
5362
  newValue: newValue
4814
5363
  } : null;
4815
5364
 
4816
- if ( notifySpy) spyReportStart(_change);
5365
+ if ( notifySpy) {
5366
+ spyReportStart(_change);
5367
+ }
4817
5368
  observable.setNewValue_(newValue);
4818
- if (notify) notifyListeners(this, _change);
4819
- if ( notifySpy) spyReportEnd();
5369
+
5370
+ if (notify) {
5371
+ notifyListeners(this, _change);
5372
+ }
5373
+
5374
+ if ( notifySpy) {
5375
+ spyReportEnd();
5376
+ }
4820
5377
  }
4821
5378
 
4822
5379
  return true;
@@ -4925,12 +5482,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4925
5482
 
4926
5483
  if (descriptor) {
4927
5484
  var outcome = annotation.make_(this, key, descriptor, source);
5485
+
4928
5486
  if (outcome === 0
4929
5487
  /* Cancel */
4930
- ) return;
5488
+ ) {
5489
+ return;
5490
+ }
5491
+
4931
5492
  if (outcome === 1
4932
5493
  /* Break */
4933
- ) break;
5494
+ ) {
5495
+ break;
5496
+ }
4934
5497
  }
4935
5498
 
4936
5499
  source = Object.getPrototypeOf(source);
@@ -5000,7 +5563,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5000
5563
  type: ADD,
5001
5564
  newValue: descriptor.value
5002
5565
  });
5003
- if (!change) return null;
5566
+
5567
+ if (!change) {
5568
+ return null;
5569
+ }
5570
+
5004
5571
  var newValue = change.newValue;
5005
5572
 
5006
5573
  if (descriptor.value !== newValue) {
@@ -5052,7 +5619,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5052
5619
  type: ADD,
5053
5620
  newValue: value
5054
5621
  });
5055
- if (!change) return null;
5622
+
5623
+ if (!change) {
5624
+ return null;
5625
+ }
5626
+
5056
5627
  value = change.newValue;
5057
5628
  }
5058
5629
 
@@ -5107,7 +5678,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5107
5678
  type: ADD,
5108
5679
  newValue: undefined
5109
5680
  });
5110
- if (!change) return null;
5681
+
5682
+ if (!change) {
5683
+ return null;
5684
+ }
5111
5685
  }
5112
5686
 
5113
5687
  options.name || (options.name = "development" !== "production" ? this.name_ + "." + key.toString() : "ObservableObject.key");
@@ -5163,7 +5737,9 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5163
5737
  type: REMOVE
5164
5738
  }); // Cancelled
5165
5739
 
5166
- if (!change) return null;
5740
+ if (!change) {
5741
+ return null;
5742
+ }
5167
5743
  } // Delete
5168
5744
 
5169
5745
 
@@ -5224,9 +5800,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5224
5800
  oldValue: value,
5225
5801
  name: key
5226
5802
  };
5227
- if ("development" !== "production" && notifySpy) spyReportStart(_change2);
5228
- if (notify) notifyListeners(this, _change2);
5229
- if ("development" !== "production" && notifySpy) spyReportEnd();
5803
+
5804
+ if ("development" !== "production" && notifySpy) {
5805
+ spyReportStart(_change2);
5806
+ }
5807
+
5808
+ if (notify) {
5809
+ notifyListeners(this, _change2);
5810
+ }
5811
+
5812
+ if ("development" !== "production" && notifySpy) {
5813
+ spyReportEnd();
5814
+ }
5230
5815
  }
5231
5816
  } finally {
5232
5817
  endBatch();
@@ -5242,7 +5827,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5242
5827
  ;
5243
5828
 
5244
5829
  _proto.observe_ = function observe_(callback, fireImmediately) {
5245
- if ( fireImmediately === true) die("`observe` doesn't support the fire immediately property for observable objects.");
5830
+ if ( fireImmediately === true) {
5831
+ die("`observe` doesn't support the fire immediately property for observable objects.");
5832
+ }
5833
+
5246
5834
  return registerListener(this, callback);
5247
5835
  };
5248
5836
 
@@ -5265,9 +5853,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5265
5853
  name: key,
5266
5854
  newValue: value
5267
5855
  } : null;
5268
- if ( notifySpy) spyReportStart(change);
5269
- if (notify) notifyListeners(this, change);
5270
- if ( notifySpy) spyReportEnd();
5856
+
5857
+ if ( notifySpy) {
5858
+ spyReportStart(change);
5859
+ }
5860
+
5861
+ if (notify) {
5862
+ notifyListeners(this, change);
5863
+ }
5864
+
5865
+ if ( notifySpy) {
5866
+ spyReportEnd();
5867
+ }
5271
5868
  }
5272
5869
 
5273
5870
  (_this$pendingKeys_2 = this.pendingKeys_) == null ? void 0 : (_this$pendingKeys_2$g = _this$pendingKeys_2.get(key)) == null ? void 0 : _this$pendingKeys_2$g.set(true); // Notify "keys/entries/values" observers
@@ -5308,7 +5905,10 @@ function asObservableObject(target, options) {
5308
5905
  return target;
5309
5906
  }
5310
5907
 
5311
- if ( !Object.isExtensible(target)) die("Cannot make the designated object observable; it is not extensible");
5908
+ if ( !Object.isExtensible(target)) {
5909
+ die("Cannot make the designated object observable; it is not extensible");
5910
+ }
5911
+
5312
5912
  var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : (isPlainObject(target) ? "ObservableObject" : target.constructor.name) + "@" + getNextId() ;
5313
5913
  var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));
5314
5914
  addHiddenProp(target, $mobx, adm);
@@ -5465,7 +6065,6 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5465
6065
  var nextIndex = 0;
5466
6066
  return makeIterable({
5467
6067
  next: function next() {
5468
- // @ts-ignore
5469
6068
  return nextIndex < self.length ? {
5470
6069
  value: self[nextIndex++],
5471
6070
  done: false
@@ -5498,7 +6097,10 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5498
6097
  Object.entries(arrayExtensions).forEach(function (_ref) {
5499
6098
  var prop = _ref[0],
5500
6099
  fn = _ref[1];
5501
- if (prop !== "concat") addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6100
+
6101
+ if (prop !== "concat") {
6102
+ addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6103
+ }
5502
6104
  });
5503
6105
 
5504
6106
  function createArrayEntryDescriptor(index) {
@@ -5535,7 +6137,10 @@ function createLegacyArray(initialValues, enhancer, name) {
5535
6137
  function getAtom(thing, property) {
5536
6138
  if (typeof thing === "object" && thing !== null) {
5537
6139
  if (isObservableArray(thing)) {
5538
- if (property !== undefined) die(23);
6140
+ if (property !== undefined) {
6141
+ die(23);
6142
+ }
6143
+
5539
6144
  return thing[$mobx].atom_;
5540
6145
  }
5541
6146
 
@@ -5544,18 +6149,31 @@ function getAtom(thing, property) {
5544
6149
  }
5545
6150
 
5546
6151
  if (isObservableMap(thing)) {
5547
- if (property === undefined) return thing.keysAtom_;
6152
+ if (property === undefined) {
6153
+ return thing.keysAtom_;
6154
+ }
6155
+
5548
6156
  var observable = thing.data_.get(property) || thing.hasMap_.get(property);
5549
- if (!observable) die(25, property, getDebugName(thing));
6157
+
6158
+ if (!observable) {
6159
+ die(25, property, getDebugName(thing));
6160
+ }
6161
+
5550
6162
  return observable;
5551
6163
  }
5552
6164
 
6165
+
5553
6166
  if (isObservableObject(thing)) {
5554
- if (!property) return die(26);
6167
+ if (!property) {
6168
+ return die(26);
6169
+ }
5555
6170
 
5556
6171
  var _observable = thing[$mobx].values_.get(property);
5557
6172
 
5558
- if (!_observable) die(27, property, getDebugName(thing));
6173
+ if (!_observable) {
6174
+ die(27, property, getDebugName(thing));
6175
+ }
6176
+
5559
6177
  return _observable;
5560
6178
  }
5561
6179
 
@@ -5572,11 +6190,26 @@ function getAtom(thing, property) {
5572
6190
  die(28);
5573
6191
  }
5574
6192
  function getAdministration(thing, property) {
5575
- if (!thing) die(29);
5576
- if (property !== undefined) return getAdministration(getAtom(thing, property));
5577
- if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing;
5578
- if (isObservableMap(thing) || isObservableSet(thing)) return thing;
5579
- if (thing[$mobx]) return thing[$mobx];
6193
+ if (!thing) {
6194
+ die(29);
6195
+ }
6196
+
6197
+ if (property !== undefined) {
6198
+ return getAdministration(getAtom(thing, property));
6199
+ }
6200
+
6201
+ if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
6202
+ return thing;
6203
+ }
6204
+
6205
+ if (isObservableMap(thing) || isObservableSet(thing)) {
6206
+ return thing;
6207
+ }
6208
+
6209
+ if (thing[$mobx]) {
6210
+ return thing[$mobx];
6211
+ }
6212
+
5580
6213
  die(24, thing);
5581
6214
  }
5582
6215
  function getDebugName(thing, property) {
@@ -5609,17 +6242,33 @@ function deepEqual(a, b, depth) {
5609
6242
  function eq(a, b, depth, aStack, bStack) {
5610
6243
  // Identical objects are equal. `0 === -0`, but they aren't identical.
5611
6244
  // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
5612
- if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison).
6245
+ if (a === b) {
6246
+ return a !== 0 || 1 / a === 1 / b;
6247
+ } // `null` or `undefined` only equal to itself (strict comparison).
6248
+
6249
+
6250
+ if (a == null || b == null) {
6251
+ return false;
6252
+ } // `NaN`s are equivalent, but non-reflexive.
5613
6253
 
5614
- if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive.
5615
6254
 
5616
- if (a !== a) return b !== b; // Exhaust primitive checks
6255
+ if (a !== a) {
6256
+ return b !== b;
6257
+ } // Exhaust primitive checks
6258
+
5617
6259
 
5618
6260
  var type = typeof a;
5619
- if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names.
6261
+
6262
+ if (type !== "function" && type !== "object" && typeof b != "object") {
6263
+ return false;
6264
+ } // Compare `[[Class]]` names.
6265
+
5620
6266
 
5621
6267
  var className = toString.call(a);
5622
- if (className !== toString.call(b)) return false;
6268
+
6269
+ if (className !== toString.call(b)) {
6270
+ return false;
6271
+ }
5623
6272
 
5624
6273
  switch (className) {
5625
6274
  // Strings, numbers, regular expressions, dates, and booleans are compared by value.
@@ -5633,7 +6282,10 @@ function eq(a, b, depth, aStack, bStack) {
5633
6282
  case "[object Number]":
5634
6283
  // `NaN`s are equivalent, but non-reflexive.
5635
6284
  // Object(NaN) is equivalent to NaN.
5636
- if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values.
6285
+ if (+a !== +a) {
6286
+ return +b !== +b;
6287
+ } // An `egal` comparison is performed for other numeric values.
6288
+
5637
6289
 
5638
6290
  return +a === 0 ? 1 / +a === 1 / b : +a === +b;
5639
6291
 
@@ -5664,9 +6316,12 @@ function eq(a, b, depth, aStack, bStack) {
5664
6316
  var areArrays = className === "[object Array]";
5665
6317
 
5666
6318
  if (!areArrays) {
5667
- if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6319
+ if (typeof a != "object" || typeof b != "object") {
6320
+ return false;
6321
+ } // Objects with different constructors are not equivalent, but `Object`s or `Array`s
5668
6322
  // from different frames are.
5669
6323
 
6324
+
5670
6325
  var aCtor = a.constructor,
5671
6326
  bCtor = b.constructor;
5672
6327
 
@@ -5692,7 +6347,9 @@ function eq(a, b, depth, aStack, bStack) {
5692
6347
  while (length--) {
5693
6348
  // Linear search. Performance is inversely proportional to the number of
5694
6349
  // unique nested structures.
5695
- if (aStack[length] === a) return bStack[length] === b;
6350
+ if (aStack[length] === a) {
6351
+ return bStack[length] === b;
6352
+ }
5696
6353
  } // Add the first object to the stack of traversed objects.
5697
6354
 
5698
6355
 
@@ -5702,10 +6359,16 @@ function eq(a, b, depth, aStack, bStack) {
5702
6359
  if (areArrays) {
5703
6360
  // Compare array lengths to determine if a deep comparison is necessary.
5704
6361
  length = a.length;
5705
- if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties.
6362
+
6363
+ if (length !== b.length) {
6364
+ return false;
6365
+ } // Deep compare the contents, ignoring non-numeric properties.
6366
+
5706
6367
 
5707
6368
  while (length--) {
5708
- if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false;
6369
+ if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {
6370
+ return false;
6371
+ }
5709
6372
  }
5710
6373
  } else {
5711
6374
  // Deep compare objects.
@@ -5713,12 +6376,17 @@ function eq(a, b, depth, aStack, bStack) {
5713
6376
  var key;
5714
6377
  length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
5715
6378
 
5716
- if (Object.keys(b).length !== length) return false;
6379
+ if (Object.keys(b).length !== length) {
6380
+ return false;
6381
+ }
5717
6382
 
5718
6383
  while (length--) {
5719
6384
  // Deep compare each member
5720
6385
  key = keys[length];
5721
- if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false;
6386
+
6387
+ if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
6388
+ return false;
6389
+ }
5722
6390
  }
5723
6391
  } // Remove the first object from the stack of traversed objects.
5724
6392
 
@@ -5729,9 +6397,18 @@ function eq(a, b, depth, aStack, bStack) {
5729
6397
  }
5730
6398
 
5731
6399
  function unwrap(a) {
5732
- if (isObservableArray(a)) return a.slice();
5733
- if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries());
5734
- if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries());
6400
+ if (isObservableArray(a)) {
6401
+ return a.slice();
6402
+ }
6403
+
6404
+ if (isES6Map(a) || isObservableMap(a)) {
6405
+ return Array.from(a.entries());
6406
+ }
6407
+
6408
+ if (isES6Set(a) || isObservableSet(a)) {
6409
+ return Array.from(a.entries());
6410
+ }
6411
+
5735
6412
  return a;
5736
6413
  }
5737
6414