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
@@ -27,9 +27,9 @@ var niceErrors = {
27
27
  10: "'has()' can only be used on observable objects, arrays and maps",
28
28
  11: "'get()' can only be used on observable objects, arrays and maps",
29
29
  12: "Invalid annotation",
30
- 13: "Dynamic observable objects cannot be frozen",
30
+ 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)",
31
31
  14: "Intercept handlers should return nothing or a change object",
32
- 15: "Observable arrays cannot be frozen",
32
+ 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)",
33
33
  16: "Modification exception: the internal structure of an observable array was changed.",
34
34
  17: function _(index, length) {
35
35
  return "[mobx.array] Index out of bounds, " + index + " is larger than " + length;
@@ -143,7 +143,10 @@ function getNextId() {
143
143
  function once(func) {
144
144
  var invoked = false;
145
145
  return function () {
146
- if (invoked) return;
146
+ if (invoked) {
147
+ return;
148
+ }
149
+
147
150
  invoked = true;
148
151
  return func.apply(this, arguments);
149
152
  };
@@ -168,17 +171,31 @@ function isObject(value) {
168
171
  return value !== null && typeof value === "object";
169
172
  }
170
173
  function isPlainObject(value) {
171
- if (!isObject(value)) return false;
174
+ if (!isObject(value)) {
175
+ return false;
176
+ }
177
+
172
178
  var proto = Object.getPrototypeOf(value);
173
- if (proto == null) return true;
179
+
180
+ if (proto == null) {
181
+ return true;
182
+ }
183
+
174
184
  var protoConstructor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
175
185
  return typeof protoConstructor === "function" && protoConstructor.toString() === plainObjectString;
176
186
  } // https://stackoverflow.com/a/37865170
177
187
 
178
188
  function isGenerator(obj) {
179
189
  var constructor = obj == null ? void 0 : obj.constructor;
180
- if (!constructor) return false;
181
- if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) return true;
190
+
191
+ if (!constructor) {
192
+ return false;
193
+ }
194
+
195
+ if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) {
196
+ return true;
197
+ }
198
+
182
199
  return false;
183
200
  }
184
201
  function addHiddenProp(object, propName, value) {
@@ -218,9 +235,16 @@ var hasGetOwnPropertySymbols = typeof Object.getOwnPropertySymbols !== "undefine
218
235
  function getPlainObjectKeys(object) {
219
236
  var keys = Object.keys(object); // Not supported in IE, so there are not going to be symbol props anyway...
220
237
 
221
- if (!hasGetOwnPropertySymbols) return keys;
238
+ if (!hasGetOwnPropertySymbols) {
239
+ return keys;
240
+ }
241
+
222
242
  var symbols = Object.getOwnPropertySymbols(object);
223
- if (!symbols.length) return keys;
243
+
244
+ if (!symbols.length) {
245
+ return keys;
246
+ }
247
+
224
248
  return [].concat(keys, symbols.filter(function (s) {
225
249
  return objectPrototype.propertyIsEnumerable.call(object, s);
226
250
  }));
@@ -233,8 +257,14 @@ var ownKeys = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKey
233
257
  /* istanbul ignore next */
234
258
  Object.getOwnPropertyNames;
235
259
  function stringifyKey(key) {
236
- if (typeof key === "string") return key;
237
- if (typeof key === "symbol") return key.toString();
260
+ if (typeof key === "string") {
261
+ return key;
262
+ }
263
+
264
+ if (typeof key === "symbol") {
265
+ return key.toString();
266
+ }
267
+
238
268
  return new String(key).toString();
239
269
  }
240
270
  function toPrimitive(value) {
@@ -522,7 +552,10 @@ function shallowComparer(a, b) {
522
552
  }
523
553
 
524
554
  function defaultComparer(a, b) {
525
- if (Object.is) return Object.is(a, b);
555
+ if (Object.is) {
556
+ return Object.is(a, b);
557
+ }
558
+
526
559
  return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
527
560
  }
528
561
 
@@ -535,20 +568,34 @@ var comparer = {
535
568
 
536
569
  function deepEnhancer(v, _, name) {
537
570
  // it is an observable already, done
538
- if (isObservable(v)) return v; // something that can be converted and mutated?
571
+ if (isObservable(v)) {
572
+ return v;
573
+ } // something that can be converted and mutated?
539
574
 
540
- if (Array.isArray(v)) return observable.array(v, {
541
- name: name
542
- });
543
- if (isPlainObject(v)) return observable.object(v, undefined, {
544
- name: name
545
- });
546
- if (isES6Map(v)) return observable.map(v, {
547
- name: name
548
- });
549
- if (isES6Set(v)) return observable.set(v, {
550
- name: name
551
- });
575
+
576
+ if (Array.isArray(v)) {
577
+ return observable.array(v, {
578
+ name: name
579
+ });
580
+ }
581
+
582
+ if (isPlainObject(v)) {
583
+ return observable.object(v, undefined, {
584
+ name: name
585
+ });
586
+ }
587
+
588
+ if (isES6Map(v)) {
589
+ return observable.map(v, {
590
+ name: name
591
+ });
592
+ }
593
+
594
+ if (isES6Set(v)) {
595
+ return observable.set(v, {
596
+ name: name
597
+ });
598
+ }
552
599
 
553
600
  if (typeof v === "function" && !isAction(v) && !isFlow(v)) {
554
601
  if (isGenerator(v)) {
@@ -561,33 +608,59 @@ function deepEnhancer(v, _, name) {
561
608
  return v;
562
609
  }
563
610
  function shallowEnhancer(v, _, name) {
564
- if (v === undefined || v === null) return v;
565
- if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) return v;
566
- if (Array.isArray(v)) return observable.array(v, {
567
- name: name,
568
- deep: false
569
- });
570
- if (isPlainObject(v)) return observable.object(v, undefined, {
571
- name: name,
572
- deep: false
573
- });
574
- if (isES6Map(v)) return observable.map(v, {
575
- name: name,
576
- deep: false
577
- });
578
- if (isES6Set(v)) return observable.set(v, {
579
- name: name,
580
- deep: false
581
- });
582
- die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
611
+ if (v === undefined || v === null) {
612
+ return v;
613
+ }
614
+
615
+ if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {
616
+ return v;
617
+ }
618
+
619
+ if (Array.isArray(v)) {
620
+ return observable.array(v, {
621
+ name: name,
622
+ deep: false
623
+ });
624
+ }
625
+
626
+ if (isPlainObject(v)) {
627
+ return observable.object(v, undefined, {
628
+ name: name,
629
+ deep: false
630
+ });
631
+ }
632
+
633
+ if (isES6Map(v)) {
634
+ return observable.map(v, {
635
+ name: name,
636
+ deep: false
637
+ });
638
+ }
639
+
640
+ if (isES6Set(v)) {
641
+ return observable.set(v, {
642
+ name: name,
643
+ deep: false
644
+ });
645
+ }
646
+
647
+ {
648
+ die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
649
+ }
583
650
  }
584
651
  function referenceEnhancer(newValue) {
585
652
  // never turn into an observable
586
653
  return newValue;
587
654
  }
588
655
  function refStructEnhancer(v, oldValue) {
589
- if ( isObservable(v)) die("observable.struct should not be used with observable values");
590
- if (deepEqual(v, oldValue)) return oldValue;
656
+ if ( isObservable(v)) {
657
+ die("observable.struct should not be used with observable values");
658
+ }
659
+
660
+ if (deepEqual(v, oldValue)) {
661
+ return oldValue;
662
+ }
663
+
591
664
  return v;
592
665
  }
593
666
 
@@ -736,9 +809,11 @@ function make_$2(adm, key, descriptor, source) {
736
809
 
737
810
 
738
811
  if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
739
- if (this.extend_(adm, key, descriptor, false) === null) return 0
740
- /* Cancel */
741
- ;
812
+ if (this.extend_(adm, key, descriptor, false) === null) {
813
+ return 0
814
+ /* Cancel */
815
+ ;
816
+ }
742
817
  }
743
818
 
744
819
  if (isFlow(descriptor.value)) {
@@ -1029,17 +1104,35 @@ function createObservable(v, arg2, arg3) {
1029
1104
  } // already observable - ignore
1030
1105
 
1031
1106
 
1032
- if (isObservable(v)) return v; // plain object
1107
+ if (isObservable(v)) {
1108
+ return v;
1109
+ } // plain object
1110
+
1111
+
1112
+ if (isPlainObject(v)) {
1113
+ return observable.object(v, arg2, arg3);
1114
+ } // Array
1115
+
1116
+
1117
+ if (Array.isArray(v)) {
1118
+ return observable.array(v, arg2);
1119
+ } // Map
1120
+
1033
1121
 
1034
- if (isPlainObject(v)) return observable.object(v, arg2, arg3); // Array
1122
+ if (isES6Map(v)) {
1123
+ return observable.map(v, arg2);
1124
+ } // Set
1035
1125
 
1036
- if (Array.isArray(v)) return observable.array(v, arg2); // Map
1037
1126
 
1038
- if (isES6Map(v)) return observable.map(v, arg2); // Set
1127
+ if (isES6Set(v)) {
1128
+ return observable.set(v, arg2);
1129
+ } // other object - ignore
1039
1130
 
1040
- if (isES6Set(v)) return observable.set(v, arg2); // other object - ignore
1041
1131
 
1042
- if (typeof v === "object" && v !== null) return v; // anything else
1132
+ if (typeof v === "object" && v !== null) {
1133
+ return v;
1134
+ } // anything else
1135
+
1043
1136
 
1044
1137
  return observable.box(v, arg2);
1045
1138
  }
@@ -1097,8 +1190,13 @@ var computed = function computed(arg1, arg2) {
1097
1190
 
1098
1191
 
1099
1192
  {
1100
- if (!isFunction(arg1)) die("First argument to `computed` should be an expression.");
1101
- if (isFunction(arg2)) die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1193
+ if (!isFunction(arg1)) {
1194
+ die("First argument to `computed` should be an expression.");
1195
+ }
1196
+
1197
+ if (isFunction(arg2)) {
1198
+ die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1199
+ }
1102
1200
  }
1103
1201
 
1104
1202
  var opts = isPlainObject(arg2) ? arg2 : {};
@@ -1130,8 +1228,13 @@ function createAction(actionName, fn, autoAction, ref) {
1130
1228
  }
1131
1229
 
1132
1230
  {
1133
- if (!isFunction(fn)) die("`action` can only be invoked on functions");
1134
- if (typeof actionName !== "string" || !actionName) die("actions should have valid names, got: '" + actionName + "'");
1231
+ if (!isFunction(fn)) {
1232
+ die("`action` can only be invoked on functions");
1233
+ }
1234
+
1235
+ if (typeof actionName !== "string" || !actionName) {
1236
+ die("actions should have valid names, got: '" + actionName + "'");
1237
+ }
1135
1238
  }
1136
1239
 
1137
1240
  function res() {
@@ -1213,7 +1316,10 @@ function _endAction(runInfo) {
1213
1316
  allowStateChangesEnd(runInfo.prevAllowStateChanges_);
1214
1317
  allowStateReadsEnd(runInfo.prevAllowStateReads_);
1215
1318
  endBatch();
1216
- if (runInfo.runAsAction_) untrackedEnd(runInfo.prevDerivation_);
1319
+
1320
+ if (runInfo.runAsAction_) {
1321
+ untrackedEnd(runInfo.prevDerivation_);
1322
+ }
1217
1323
 
1218
1324
  if ( runInfo.notifySpy_) {
1219
1325
  spyReportEnd({
@@ -1293,7 +1399,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1293
1399
  var _proto = ObservableValue.prototype;
1294
1400
 
1295
1401
  _proto.dehanceValue = function dehanceValue(value) {
1296
- if (this.dehancer !== undefined) return this.dehancer(value);
1402
+ if (this.dehancer !== undefined) {
1403
+ return this.dehancer(value);
1404
+ }
1405
+
1297
1406
  return value;
1298
1407
  };
1299
1408
 
@@ -1316,7 +1425,10 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1316
1425
  }
1317
1426
 
1318
1427
  this.setNewValue_(newValue);
1319
- if ( notifySpy) spyReportEnd();
1428
+
1429
+ if ( notifySpy) {
1430
+ spyReportEnd();
1431
+ }
1320
1432
  }
1321
1433
  };
1322
1434
 
@@ -1329,7 +1441,11 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1329
1441
  type: UPDATE,
1330
1442
  newValue: newValue
1331
1443
  });
1332
- if (!change) return globalState.UNCHANGED;
1444
+
1445
+ if (!change) {
1446
+ return globalState.UNCHANGED;
1447
+ }
1448
+
1333
1449
  newValue = change.newValue;
1334
1450
  } // apply modifier
1335
1451
 
@@ -1363,14 +1479,17 @@ var ObservableValue = /*#__PURE__*/function (_Atom, _Symbol$toPrimitive2) {
1363
1479
  };
1364
1480
 
1365
1481
  _proto.observe_ = function observe_(listener, fireImmediately) {
1366
- if (fireImmediately) listener({
1367
- observableKind: "value",
1368
- debugObjectName: this.name_,
1369
- object: this,
1370
- type: UPDATE,
1371
- newValue: this.value_,
1372
- oldValue: undefined
1373
- });
1482
+ if (fireImmediately) {
1483
+ listener({
1484
+ observableKind: "value",
1485
+ debugObjectName: this.name_,
1486
+ object: this,
1487
+ type: UPDATE,
1488
+ newValue: this.value_,
1489
+ oldValue: undefined
1490
+ });
1491
+ }
1492
+
1374
1493
  return registerListener(this, listener);
1375
1494
  };
1376
1495
 
@@ -1465,7 +1584,11 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1465
1584
  this.keepAlive_ = void 0;
1466
1585
  this.onBOL = void 0;
1467
1586
  this.onBUOL = void 0;
1468
- if (!options.get) die(31);
1587
+
1588
+ if (!options.get) {
1589
+ die(31);
1590
+ }
1591
+
1469
1592
  this.derivation = options.get;
1470
1593
  this.name_ = options.name || ( "ComputedValue@" + getNextId() );
1471
1594
 
@@ -1507,7 +1630,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1507
1630
  ;
1508
1631
 
1509
1632
  _proto.get = function get() {
1510
- if (this.isComputing_) die(32, this.name_, this.derivation);
1633
+ if (this.isComputing_) {
1634
+ die(32, this.name_, this.derivation);
1635
+ }
1511
1636
 
1512
1637
  if (globalState.inBatch === 0 && // !globalState.trackingDerivatpion &&
1513
1638
  this.observers_.size === 0 && !this.keepAlive_) {
@@ -1523,20 +1648,34 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1523
1648
 
1524
1649
  if (shouldCompute(this)) {
1525
1650
  var prevTrackingContext = globalState.trackingContext;
1526
- if (this.keepAlive_ && !prevTrackingContext) globalState.trackingContext = this;
1527
- if (this.trackAndCompute()) propagateChangeConfirmed(this);
1651
+
1652
+ if (this.keepAlive_ && !prevTrackingContext) {
1653
+ globalState.trackingContext = this;
1654
+ }
1655
+
1656
+ if (this.trackAndCompute()) {
1657
+ propagateChangeConfirmed(this);
1658
+ }
1659
+
1528
1660
  globalState.trackingContext = prevTrackingContext;
1529
1661
  }
1530
1662
  }
1531
1663
 
1532
1664
  var result = this.value_;
1533
- if (isCaughtException(result)) throw result.cause;
1665
+
1666
+ if (isCaughtException(result)) {
1667
+ throw result.cause;
1668
+ }
1669
+
1534
1670
  return result;
1535
1671
  };
1536
1672
 
1537
1673
  _proto.set = function set(value) {
1538
1674
  if (this.setter_) {
1539
- if (this.isRunningSetter_) die(33, this.name_);
1675
+ if (this.isRunningSetter_) {
1676
+ die(33, this.name_);
1677
+ }
1678
+
1540
1679
  this.isRunningSetter_ = true;
1541
1680
 
1542
1681
  try {
@@ -1544,7 +1683,9 @@ var ComputedValue = /*#__PURE__*/function (_Symbol$toPrimitive2) {
1544
1683
  } finally {
1545
1684
  this.isRunningSetter_ = false;
1546
1685
  }
1547
- } else die(34, this.name_);
1686
+ } else {
1687
+ die(34, this.name_);
1688
+ }
1548
1689
  };
1549
1690
 
1550
1691
  _proto.trackAndCompute = function trackAndCompute() {
@@ -1773,7 +1914,9 @@ function checkIfStateModificationsAreAllowed(atom) {
1773
1914
 
1774
1915
  var hasObservers = atom.observers_.size > 0; // Should not be possible to change observed state outside strict mode, except during initialization, see #563
1775
1916
 
1776
- 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_);
1917
+ if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) {
1918
+ 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_);
1919
+ }
1777
1920
  }
1778
1921
  function checkIfStateReadsAreAllowed(observable) {
1779
1922
  if ( !globalState.allowStateReads && globalState.observableRequiresReaction) {
@@ -1818,7 +1961,10 @@ function trackDerivedFunction(derivation, f, context) {
1818
1961
  }
1819
1962
 
1820
1963
  function warnAboutDerivationWithoutDependencies(derivation) {
1821
- if (derivation.observing_.length !== 0) return;
1964
+
1965
+ if (derivation.observing_.length !== 0) {
1966
+ return;
1967
+ }
1822
1968
 
1823
1969
  if (globalState.reactionRequiresObservable || derivation.requiresObservable_) {
1824
1970
  console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
@@ -1847,7 +1993,11 @@ function bindDependencies(derivation) {
1847
1993
 
1848
1994
  if (dep.diffValue_ === 0) {
1849
1995
  dep.diffValue_ = 1;
1850
- if (i0 !== i) observing[i0] = dep;
1996
+
1997
+ if (i0 !== i) {
1998
+ observing[i0] = dep;
1999
+ }
2000
+
1851
2001
  i0++;
1852
2002
  } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
1853
2003
  // not hitting the condition
@@ -1939,7 +2089,10 @@ function allowStateReadsEnd(prev) {
1939
2089
  */
1940
2090
 
1941
2091
  function changeDependenciesStateTo0(derivation) {
1942
- if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) return;
2092
+ if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
2093
+ return;
2094
+ }
2095
+
1943
2096
  derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;
1944
2097
  var obs = derivation.observing_;
1945
2098
  var i = obs.length;
@@ -1983,8 +2136,14 @@ var canMergeGlobalState = true;
1983
2136
  var isolateCalled = false;
1984
2137
  var globalState = /*#__PURE__*/function () {
1985
2138
  var global = /*#__PURE__*/getGlobal();
1986
- if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false;
1987
- if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) canMergeGlobalState = false;
2139
+
2140
+ if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {
2141
+ canMergeGlobalState = false;
2142
+ }
2143
+
2144
+ if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {
2145
+ canMergeGlobalState = false;
2146
+ }
1988
2147
 
1989
2148
  if (!canMergeGlobalState) {
1990
2149
  // Because this is a IIFE we need to let isolateCalled a chance to change
@@ -1997,7 +2156,11 @@ var globalState = /*#__PURE__*/function () {
1997
2156
  return new MobXGlobals();
1998
2157
  } else if (global.__mobxGlobals) {
1999
2158
  global.__mobxInstanceCount += 1;
2000
- if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
2159
+
2160
+ if (!global.__mobxGlobals.UNCHANGED) {
2161
+ global.__mobxGlobals.UNCHANGED = {};
2162
+ } // make merge backward compatible
2163
+
2001
2164
 
2002
2165
  return global.__mobxGlobals;
2003
2166
  } else {
@@ -2006,12 +2169,19 @@ var globalState = /*#__PURE__*/function () {
2006
2169
  }
2007
2170
  }();
2008
2171
  function isolateGlobalState() {
2009
- if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) die(36);
2172
+ if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {
2173
+ die(36);
2174
+ }
2175
+
2010
2176
  isolateCalled = true;
2011
2177
 
2012
2178
  if (canMergeGlobalState) {
2013
2179
  var global = getGlobal();
2014
- if (--global.__mobxInstanceCount === 0) global.__mobxGlobals = undefined;
2180
+
2181
+ if (--global.__mobxInstanceCount === 0) {
2182
+ global.__mobxGlobals = undefined;
2183
+ }
2184
+
2015
2185
  globalState = new MobXGlobals();
2016
2186
  }
2017
2187
  }
@@ -2027,7 +2197,9 @@ function resetGlobalState() {
2027
2197
  var defaultGlobals = new MobXGlobals();
2028
2198
 
2029
2199
  for (var key in defaultGlobals) {
2030
- if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];
2200
+ if (persistentKeys.indexOf(key) === -1) {
2201
+ globalState[key] = defaultGlobals[key];
2202
+ }
2031
2203
  }
2032
2204
 
2033
2205
  globalState.allowStateChanges = !globalState.enforceActions;
@@ -2061,8 +2233,12 @@ function addObserver(observable, node) {
2061
2233
  // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
2062
2234
  // invariantObservers(observable);
2063
2235
  observable.observers_.add(node);
2064
- if (observable.lowestObserverState_ > node.dependenciesState_) observable.lowestObserverState_ = node.dependenciesState_; // invariantObservers(observable);
2236
+
2237
+ if (observable.lowestObserverState_ > node.dependenciesState_) {
2238
+ observable.lowestObserverState_ = node.dependenciesState_;
2239
+ } // invariantObservers(observable);
2065
2240
  // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
2241
+
2066
2242
  }
2067
2243
  function removeObserver(observable, node) {
2068
2244
  // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
@@ -2173,7 +2349,10 @@ function reportObserved(observable) {
2173
2349
 
2174
2350
  function propagateChanged(observable) {
2175
2351
  // invariantLOS(observable, "changed start");
2176
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2352
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2353
+ return;
2354
+ }
2355
+
2177
2356
  observable.lowestObserverState_ = IDerivationState_.STALE_; // Ideally we use for..of here, but the downcompiled version is really slow...
2178
2357
 
2179
2358
  observable.observers_.forEach(function (d) {
@@ -2191,7 +2370,10 @@ function propagateChanged(observable) {
2191
2370
 
2192
2371
  function propagateChangeConfirmed(observable) {
2193
2372
  // invariantLOS(observable, "confirmed start");
2194
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2373
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2374
+ return;
2375
+ }
2376
+
2195
2377
  observable.lowestObserverState_ = IDerivationState_.STALE_;
2196
2378
  observable.observers_.forEach(function (d) {
2197
2379
  if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {
@@ -2209,7 +2391,10 @@ function propagateChangeConfirmed(observable) {
2209
2391
 
2210
2392
  function propagateMaybeChanged(observable) {
2211
2393
  // invariantLOS(observable, "maybe start");
2212
- if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) return;
2394
+ if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {
2395
+ return;
2396
+ }
2397
+
2213
2398
  observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;
2214
2399
  observable.observers_.forEach(function (d) {
2215
2400
  if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
@@ -2237,9 +2422,12 @@ function printDepTree(tree, lines, depth) {
2237
2422
  }
2238
2423
 
2239
2424
  lines.push("" + "\t".repeat(depth - 1) + tree.name);
2240
- if (tree.dependencies) tree.dependencies.forEach(function (child) {
2241
- return printDepTree(child, lines, depth + 1);
2242
- });
2425
+
2426
+ if (tree.dependencies) {
2427
+ tree.dependencies.forEach(function (child) {
2428
+ return printDepTree(child, lines, depth + 1);
2429
+ });
2430
+ }
2243
2431
  }
2244
2432
 
2245
2433
  var Reaction = /*#__PURE__*/function () {
@@ -2357,7 +2545,9 @@ var Reaction = /*#__PURE__*/function () {
2357
2545
  clearObserving(this);
2358
2546
  }
2359
2547
 
2360
- if (isCaughtException(result)) this.reportExceptionInDerivation_(result.cause);
2548
+ if (isCaughtException(result)) {
2549
+ this.reportExceptionInDerivation_(result.cause);
2550
+ }
2361
2551
 
2362
2552
  if ( notify) {
2363
2553
  spyReportEnd({
@@ -2376,13 +2566,18 @@ var Reaction = /*#__PURE__*/function () {
2376
2566
  return;
2377
2567
  }
2378
2568
 
2379
- if (globalState.disableErrorBoundaries) throw error;
2569
+ if (globalState.disableErrorBoundaries) {
2570
+ throw error;
2571
+ }
2572
+
2380
2573
  var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'" ;
2381
2574
 
2382
2575
  if (!globalState.suppressReactionErrors) {
2383
2576
  console.error(message, error);
2384
2577
  /** If debugging brought you here, please, read the above message :-). Tnx! */
2385
- } else console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)"); // prettier-ignore
2578
+ } else {
2579
+ console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)");
2580
+ } // prettier-ignore
2386
2581
 
2387
2582
 
2388
2583
  if ( isSpyEnabled()) {
@@ -2436,7 +2631,10 @@ function onReactionError(handler) {
2436
2631
  globalState.globalReactionErrorHandlers.push(handler);
2437
2632
  return function () {
2438
2633
  var idx = globalState.globalReactionErrorHandlers.indexOf(handler);
2439
- if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1);
2634
+
2635
+ if (idx >= 0) {
2636
+ globalState.globalReactionErrorHandlers.splice(idx, 1);
2637
+ }
2440
2638
  };
2441
2639
  }
2442
2640
  /**
@@ -2453,7 +2651,10 @@ var reactionScheduler = function reactionScheduler(f) {
2453
2651
 
2454
2652
  function runReactions() {
2455
2653
  // Trampolining, if runReactions are already running, new reactions will be picked up
2456
- if (globalState.inBatch > 0 || globalState.isRunningReactions) return;
2654
+ if (globalState.inBatch > 0 || globalState.isRunningReactions) {
2655
+ return;
2656
+ }
2657
+
2457
2658
  reactionScheduler(runReactionsHelper);
2458
2659
  }
2459
2660
 
@@ -2496,7 +2697,11 @@ function isSpyEnabled() {
2496
2697
  }
2497
2698
  function spyReport(event) {
2498
2699
 
2499
- if (!globalState.spyListeners.length) return;
2700
+
2701
+ if (!globalState.spyListeners.length) {
2702
+ return;
2703
+ }
2704
+
2500
2705
  var listeners = globalState.spyListeners;
2501
2706
 
2502
2707
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -2516,10 +2721,15 @@ var END_EVENT = {
2516
2721
  spyReportEnd: true
2517
2722
  };
2518
2723
  function spyReportEnd(change) {
2519
- if (change) spyReport(_extends({}, change, {
2520
- type: "report-end",
2521
- spyReportEnd: true
2522
- }));else spyReport(END_EVENT);
2724
+
2725
+ if (change) {
2726
+ spyReport(_extends({}, change, {
2727
+ type: "report-end",
2728
+ spyReportEnd: true
2729
+ }));
2730
+ } else {
2731
+ spyReport(END_EVENT);
2732
+ }
2523
2733
  }
2524
2734
  function spy(listener) {
2525
2735
  {
@@ -2552,9 +2762,15 @@ var autoActionBoundAnnotation = /*#__PURE__*/createActionAnnotation(AUTOACTION_B
2552
2762
  function createActionFactory(autoAction) {
2553
2763
  var res = function action(arg1, arg2) {
2554
2764
  // action(fn() {})
2555
- if (isFunction(arg1)) return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction); // action("name", fn() {})
2765
+ if (isFunction(arg1)) {
2766
+ return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);
2767
+ } // action("name", fn() {})
2768
+
2769
+
2770
+ if (isFunction(arg2)) {
2771
+ return createAction(arg1, arg2, autoAction);
2772
+ } // @action
2556
2773
 
2557
- if (isFunction(arg2)) return createAction(arg1, arg2, autoAction); // @action
2558
2774
 
2559
2775
  if (isStringish(arg2)) {
2560
2776
  return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
@@ -2568,7 +2784,9 @@ function createActionFactory(autoAction) {
2568
2784
  }));
2569
2785
  }
2570
2786
 
2571
- die("Invalid arguments for `action`");
2787
+ {
2788
+ die("Invalid arguments for `action`");
2789
+ }
2572
2790
  };
2573
2791
 
2574
2792
  return res;
@@ -2602,8 +2820,13 @@ function autorun(view, opts) {
2602
2820
  }
2603
2821
 
2604
2822
  {
2605
- if (!isFunction(view)) die("Autorun expects a function as first argument");
2606
- if (isAction(view)) die("Autorun does not accept actions since actions are untrackable");
2823
+ if (!isFunction(view)) {
2824
+ die("Autorun expects a function as first argument");
2825
+ }
2826
+
2827
+ if (isAction(view)) {
2828
+ die("Autorun does not accept actions since actions are untrackable");
2829
+ }
2607
2830
  }
2608
2831
 
2609
2832
  var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : view.name || "Autorun@" + getNextId() ;
@@ -2624,7 +2847,10 @@ function autorun(view, opts) {
2624
2847
  isScheduled = true;
2625
2848
  scheduler(function () {
2626
2849
  isScheduled = false;
2627
- if (!reaction.isDisposed_) reaction.track(reactionRunner);
2850
+
2851
+ if (!reaction.isDisposed_) {
2852
+ reaction.track(reactionRunner);
2853
+ }
2628
2854
  });
2629
2855
  }
2630
2856
  }, opts.onError, opts.requiresObservable);
@@ -2656,8 +2882,13 @@ function reaction(expression, effect, opts) {
2656
2882
  }
2657
2883
 
2658
2884
  {
2659
- if (!isFunction(expression) || !isFunction(effect)) die("First and second argument to reaction should be functions");
2660
- if (!isPlainObject(opts)) die("Third argument of reactions should be an object");
2885
+ if (!isFunction(expression) || !isFunction(effect)) {
2886
+ die("First and second argument to reaction should be functions");
2887
+ }
2888
+
2889
+ if (!isPlainObject(opts)) {
2890
+ die("Third argument of reactions should be an object");
2891
+ }
2661
2892
  }
2662
2893
 
2663
2894
  var name = (_opts$name2 = opts.name) != null ? _opts$name2 : "Reaction@" + getNextId() ;
@@ -2680,7 +2911,11 @@ function reaction(expression, effect, opts) {
2680
2911
 
2681
2912
  function reactionRunner() {
2682
2913
  isScheduled = false;
2683
- if (r.isDisposed_) return;
2914
+
2915
+ if (r.isDisposed_) {
2916
+ return;
2917
+ }
2918
+
2684
2919
  var changed = false;
2685
2920
  r.track(function () {
2686
2921
  var nextValue = allowStateChanges(false, function () {
@@ -2690,7 +2925,13 @@ function reaction(expression, effect, opts) {
2690
2925
  oldValue = value;
2691
2926
  value = nextValue;
2692
2927
  });
2693
- if (firstTime && opts.fireImmediately) effectAction(value, oldValue, r);else if (!firstTime && changed) effectAction(value, oldValue, r);
2928
+
2929
+ if (firstTime && opts.fireImmediately) {
2930
+ effectAction(value, oldValue, r);
2931
+ } else if (!firstTime && changed) {
2932
+ effectAction(value, oldValue, r);
2933
+ }
2934
+
2694
2935
  firstTime = false;
2695
2936
  }
2696
2937
 
@@ -2757,7 +2998,9 @@ function configure(options) {
2757
2998
  globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== "undefined";
2758
2999
  }
2759
3000
 
2760
- if (useProxies === "ifavailable") globalState.verifyProxies = true;
3001
+ if (useProxies === "ifavailable") {
3002
+ globalState.verifyProxies = true;
3003
+ }
2761
3004
 
2762
3005
  if (enforceActions !== undefined) {
2763
3006
  var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;
@@ -2765,7 +3008,9 @@ function configure(options) {
2765
3008
  globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;
2766
3009
  }
2767
3010
  ["computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "disableErrorBoundaries", "safeDescriptors"].forEach(function (key) {
2768
- if (key in options) globalState[key] = !!options[key];
3011
+ if (key in options) {
3012
+ globalState[key] = !!options[key];
3013
+ }
2769
3014
  });
2770
3015
  globalState.allowStateReads = !globalState.observableRequiresReaction;
2771
3016
 
@@ -2780,11 +3025,25 @@ function configure(options) {
2780
3025
 
2781
3026
  function extendObservable(target, properties, annotations, options) {
2782
3027
  {
2783
- if (arguments.length > 4) die("'extendObservable' expected 2-4 arguments");
2784
- if (typeof target !== "object") die("'extendObservable' expects an object as first argument");
2785
- if (isObservableMap(target)) die("'extendObservable' should not be used on maps, use map.merge instead");
2786
- if (!isPlainObject(properties)) die("'extendObservable' only accepts plain objects as second argument");
2787
- if (isObservable(properties) || isObservable(annotations)) die("Extending an object with another observable (object) is not supported");
3028
+ if (arguments.length > 4) {
3029
+ die("'extendObservable' expected 2-4 arguments");
3030
+ }
3031
+
3032
+ if (typeof target !== "object") {
3033
+ die("'extendObservable' expects an object as first argument");
3034
+ }
3035
+
3036
+ if (isObservableMap(target)) {
3037
+ die("'extendObservable' should not be used on maps, use map.merge instead");
3038
+ }
3039
+
3040
+ if (!isPlainObject(properties)) {
3041
+ die("'extendObservable' only accepts plain objects as second argument");
3042
+ }
3043
+
3044
+ if (isObservable(properties) || isObservable(annotations)) {
3045
+ die("Extending an object with another observable (object) is not supported");
3046
+ }
2788
3047
  } // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)
2789
3048
 
2790
3049
 
@@ -2812,7 +3071,11 @@ function nodeToDependencyTree(node) {
2812
3071
  var result = {
2813
3072
  name: node.name_
2814
3073
  };
2815
- if (node.observing_ && node.observing_.length > 0) result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3074
+
3075
+ if (node.observing_ && node.observing_.length > 0) {
3076
+ result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3077
+ }
3078
+
2816
3079
  return result;
2817
3080
  }
2818
3081
 
@@ -2824,7 +3087,11 @@ function nodeToObserverTree(node) {
2824
3087
  var result = {
2825
3088
  name: node.name_
2826
3089
  };
2827
- if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3090
+
3091
+ if (hasObservers(node)) {
3092
+ result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3093
+ }
3094
+
2828
3095
  return result;
2829
3096
  }
2830
3097
 
@@ -2851,7 +3118,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2851
3118
  } // flow(fn)
2852
3119
 
2853
3120
 
2854
- if ( arguments.length !== 1) die("Flow expects single argument with generator function");
3121
+ if ( arguments.length !== 1) {
3122
+ die("Flow expects single argument with generator function");
3123
+ }
3124
+
2855
3125
  var generator = arg1;
2856
3126
  var name = generator.name || "<unnamed flow>"; // Implementation based on https://github.com/tj/co/blob/master/index.js
2857
3127
 
@@ -2899,7 +3169,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2899
3169
  return;
2900
3170
  }
2901
3171
 
2902
- if (ret.done) return resolve(ret.value);
3172
+ if (ret.done) {
3173
+ return resolve(ret.value);
3174
+ }
3175
+
2903
3176
  pendingPromise = Promise.resolve(ret.value);
2904
3177
  return pendingPromise.then(onFulfilled, onRejected);
2905
3178
  }
@@ -2908,7 +3181,10 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2908
3181
  });
2909
3182
  promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
2910
3183
  try {
2911
- if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff..
3184
+ if (pendingPromise) {
3185
+ cancelPromise(pendingPromise);
3186
+ } // Finally block can return (or yield) stuff..
3187
+
2912
3188
 
2913
3189
  var _res = gen["return"](undefined); // eat anything that promise would do, it's cancelled!
2914
3190
 
@@ -2932,7 +3208,9 @@ var flow = /*#__PURE__*/Object.assign(function flow(arg1, arg2) {
2932
3208
  flow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);
2933
3209
 
2934
3210
  function cancelPromise(promise) {
2935
- if (isFunction(promise.cancel)) promise.cancel();
3211
+ if (isFunction(promise.cancel)) {
3212
+ promise.cancel();
3213
+ }
2936
3214
  }
2937
3215
 
2938
3216
  function flowResult(result) {
@@ -2948,13 +3226,19 @@ function interceptReads(thing, propOrHandler, handler) {
2948
3226
  if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {
2949
3227
  target = getAdministration(thing);
2950
3228
  } else if (isObservableObject(thing)) {
2951
- if ( !isStringish(propOrHandler)) return die("InterceptReads can only be used with a specific property, not with an object in general");
3229
+ if ( !isStringish(propOrHandler)) {
3230
+ return die("InterceptReads can only be used with a specific property, not with an object in general");
3231
+ }
3232
+
2952
3233
  target = getAdministration(thing, propOrHandler);
2953
3234
  } else {
2954
3235
  return die("Expected observable map, object or array as first array");
2955
3236
  }
2956
3237
 
2957
- if ( target.dehancer !== undefined) return die("An intercept reader was already established");
3238
+ if ( target.dehancer !== undefined) {
3239
+ return die("An intercept reader was already established");
3240
+ }
3241
+
2958
3242
  target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
2959
3243
  return function () {
2960
3244
  target.dehancer = undefined;
@@ -2962,7 +3246,11 @@ function interceptReads(thing, propOrHandler, handler) {
2962
3246
  }
2963
3247
 
2964
3248
  function intercept(thing, propOrHandler, handler) {
2965
- if (isFunction(handler)) return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler);
3249
+ if (isFunction(handler)) {
3250
+ return interceptProperty(thing, propOrHandler, handler);
3251
+ } else {
3252
+ return interceptInterceptable(thing, propOrHandler);
3253
+ }
2966
3254
  }
2967
3255
 
2968
3256
  function interceptInterceptable(thing, handler) {
@@ -2978,25 +3266,41 @@ function _isComputed(value, property) {
2978
3266
  return isComputedValue(value);
2979
3267
  }
2980
3268
 
2981
- if (isObservableObject(value) === false) return false;
2982
- if (!value[$mobx].values_.has(property)) return false;
3269
+ if (isObservableObject(value) === false) {
3270
+ return false;
3271
+ }
3272
+
3273
+ if (!value[$mobx].values_.has(property)) {
3274
+ return false;
3275
+ }
3276
+
2983
3277
  var atom = getAtom(value, property);
2984
3278
  return isComputedValue(atom);
2985
3279
  }
2986
3280
  function isComputed(value) {
2987
- if ( arguments.length > 1) return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3281
+ if ( arguments.length > 1) {
3282
+ return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3283
+ }
3284
+
2988
3285
  return _isComputed(value);
2989
3286
  }
2990
3287
  function isComputedProp(value, propName) {
2991
- if ( !isStringish(propName)) return die("isComputed expected a property name as second argument");
3288
+ if ( !isStringish(propName)) {
3289
+ return die("isComputed expected a property name as second argument");
3290
+ }
3291
+
2992
3292
  return _isComputed(value, propName);
2993
3293
  }
2994
3294
 
2995
3295
  function _isObservable(value, property) {
2996
- if (!value) return false;
3296
+ if (!value) {
3297
+ return false;
3298
+ }
2997
3299
 
2998
3300
  if (property !== undefined) {
2999
- if ( (isObservableMap(value) || isObservableArray(value))) return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3301
+ if ( (isObservableMap(value) || isObservableArray(value))) {
3302
+ return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3303
+ }
3000
3304
 
3001
3305
  if (isObservableObject(value)) {
3002
3306
  return value[$mobx].values_.has(property);
@@ -3010,11 +3314,17 @@ function _isObservable(value, property) {
3010
3314
  }
3011
3315
 
3012
3316
  function isObservable(value) {
3013
- if ( arguments.length !== 1) die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3317
+ if ( arguments.length !== 1) {
3318
+ die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3319
+ }
3320
+
3014
3321
  return _isObservable(value);
3015
3322
  }
3016
3323
  function isObservableProp(value, propName) {
3017
- if ( !isStringish(propName)) return die("expected a property name as second argument");
3324
+ if ( !isStringish(propName)) {
3325
+ return die("expected a property name as second argument");
3326
+ }
3327
+
3018
3328
  return _isObservable(value, propName);
3019
3329
  }
3020
3330
 
@@ -3106,13 +3416,25 @@ function set(obj, key, value) {
3106
3416
  } else if (isObservableSet(obj)) {
3107
3417
  obj.add(key);
3108
3418
  } else if (isObservableArray(obj)) {
3109
- if (typeof key !== "number") key = parseInt(key, 10);
3110
- if (key < 0) die("Invalid index: '" + key + "'");
3419
+ if (typeof key !== "number") {
3420
+ key = parseInt(key, 10);
3421
+ }
3422
+
3423
+ if (key < 0) {
3424
+ die("Invalid index: '" + key + "'");
3425
+ }
3426
+
3111
3427
  startBatch();
3112
- if (key >= obj.length) obj.length = key + 1;
3428
+
3429
+ if (key >= obj.length) {
3430
+ obj.length = key + 1;
3431
+ }
3432
+
3113
3433
  obj[key] = value;
3114
3434
  endBatch();
3115
- } else die(8);
3435
+ } else {
3436
+ die(8);
3437
+ }
3116
3438
  }
3117
3439
  function remove(obj, key) {
3118
3440
  if (isObservableObject(obj)) {
@@ -3122,7 +3444,10 @@ function remove(obj, key) {
3122
3444
  } else if (isObservableSet(obj)) {
3123
3445
  obj["delete"](key);
3124
3446
  } else if (isObservableArray(obj)) {
3125
- if (typeof key !== "number") key = parseInt(key, 10);
3447
+ if (typeof key !== "number") {
3448
+ key = parseInt(key, 10);
3449
+ }
3450
+
3126
3451
  obj.splice(key, 1);
3127
3452
  } else {
3128
3453
  die(9);
@@ -3142,7 +3467,9 @@ function has(obj, key) {
3142
3467
  die(10);
3143
3468
  }
3144
3469
  function get(obj, key) {
3145
- if (!has(obj, key)) return undefined;
3470
+ if (!has(obj, key)) {
3471
+ return undefined;
3472
+ }
3146
3473
 
3147
3474
  if (isObservableObject(obj)) {
3148
3475
  return obj[$mobx].get_(key);
@@ -3170,7 +3497,11 @@ function apiOwnKeys(obj) {
3170
3497
  }
3171
3498
 
3172
3499
  function observe(thing, propOrCb, cbOrFire, fireImmediately) {
3173
- if (isFunction(cbOrFire)) return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire);
3500
+ if (isFunction(cbOrFire)) {
3501
+ return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
3502
+ } else {
3503
+ return observeObservable(thing, propOrCb, cbOrFire);
3504
+ }
3174
3505
  }
3175
3506
 
3176
3507
  function observeObservable(thing, listener, fireImmediately) {
@@ -3187,8 +3518,13 @@ function cache(map, key, value) {
3187
3518
  }
3188
3519
 
3189
3520
  function toJSHelper(source, __alreadySeen) {
3190
- if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) return source;
3191
- if (isObservableValue(source) || isComputedValue(source)) return toJSHelper(source.get(), __alreadySeen);
3521
+ if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) {
3522
+ return source;
3523
+ }
3524
+
3525
+ if (isObservableValue(source) || isComputedValue(source)) {
3526
+ return toJSHelper(source.get(), __alreadySeen);
3527
+ }
3192
3528
 
3193
3529
  if (__alreadySeen.has(source)) {
3194
3530
  return __alreadySeen.get(source);
@@ -3239,18 +3575,25 @@ function toJSHelper(source, __alreadySeen) {
3239
3575
 
3240
3576
 
3241
3577
  function toJS(source, options) {
3242
- if ( options) die("toJS no longer supports options");
3578
+ if ( options) {
3579
+ die("toJS no longer supports options");
3580
+ }
3581
+
3243
3582
  return toJSHelper(source, new Map());
3244
3583
  }
3245
3584
 
3246
3585
  function trace() {
3586
+
3247
3587
  var enterBreakPoint = false;
3248
3588
 
3249
3589
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3250
3590
  args[_key] = arguments[_key];
3251
3591
  }
3252
3592
 
3253
- if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop();
3593
+ if (typeof args[args.length - 1] === "boolean") {
3594
+ enterBreakPoint = args.pop();
3595
+ }
3596
+
3254
3597
  var derivation = getAtomFromArgs(args);
3255
3598
 
3256
3599
  if (!derivation) {
@@ -3300,7 +3643,10 @@ function transaction(action, thisArg) {
3300
3643
  }
3301
3644
 
3302
3645
  function when(predicate, arg1, arg2) {
3303
- if (arguments.length === 1 || arg1 && typeof arg1 === "object") return whenPromise(predicate, arg1);
3646
+ if (arguments.length === 1 || arg1 && typeof arg1 === "object") {
3647
+ return whenPromise(predicate, arg1);
3648
+ }
3649
+
3304
3650
  return _when(predicate, arg1, arg2 || {});
3305
3651
  }
3306
3652
 
@@ -3312,7 +3658,12 @@ function _when(predicate, effect, opts) {
3312
3658
  timeoutHandle = setTimeout(function () {
3313
3659
  if (!disposer[$mobx].isDisposed_) {
3314
3660
  disposer();
3315
- if (opts.onError) opts.onError(error);else throw error;
3661
+
3662
+ if (opts.onError) {
3663
+ opts.onError(error);
3664
+ } else {
3665
+ throw error;
3666
+ }
3316
3667
  }
3317
3668
  }, opts.timeout);
3318
3669
  }
@@ -3326,7 +3677,11 @@ function _when(predicate, effect, opts) {
3326
3677
 
3327
3678
  if (cond) {
3328
3679
  r.dispose();
3329
- if (timeoutHandle) clearTimeout(timeoutHandle);
3680
+
3681
+ if (timeoutHandle) {
3682
+ clearTimeout(timeoutHandle);
3683
+ }
3684
+
3330
3685
  effectAction();
3331
3686
  }
3332
3687
  }, opts);
@@ -3334,7 +3689,10 @@ function _when(predicate, effect, opts) {
3334
3689
  }
3335
3690
 
3336
3691
  function whenPromise(predicate, opts) {
3337
- if ( opts && opts.onError) return die("the options 'onError' and 'promise' cannot be combined");
3692
+ if ( opts && opts.onError) {
3693
+ return die("the options 'onError' and 'promise' cannot be combined");
3694
+ }
3695
+
3338
3696
  var cancel;
3339
3697
  var res = new Promise(function (resolve, reject) {
3340
3698
  var disposer = _when(predicate, resolve, _extends({}, opts, {
@@ -3358,7 +3716,10 @@ function getAdm(target) {
3358
3716
 
3359
3717
  var objectProxyTraps = {
3360
3718
  has: function has(target, name) {
3361
- if ( globalState.trackingDerivation) warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3719
+ if ( globalState.trackingDerivation) {
3720
+ warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3721
+ }
3722
+
3362
3723
  return getAdm(target).has_(name);
3363
3724
  },
3364
3725
  get: function get(target, name) {
@@ -3367,7 +3728,9 @@ var objectProxyTraps = {
3367
3728
  set: function set(target, name, value) {
3368
3729
  var _getAdm$set_;
3369
3730
 
3370
- if (!isStringish(name)) return false;
3731
+ if (!isStringish(name)) {
3732
+ return false;
3733
+ }
3371
3734
 
3372
3735
  if ( !getAdm(target).values_.has(name)) {
3373
3736
  warnAboutProxyRequirement("add a new observable property through direct assignment. Use 'set' from 'mobx' instead.");
@@ -3383,7 +3746,10 @@ var objectProxyTraps = {
3383
3746
  warnAboutProxyRequirement("delete properties from an observable object. Use 'remove' from 'mobx' instead.");
3384
3747
  }
3385
3748
 
3386
- if (!isStringish(name)) return false; // null (intercepted) -> true (success)
3749
+ if (!isStringish(name)) {
3750
+ return false;
3751
+ } // null (intercepted) -> true (success)
3752
+
3387
3753
 
3388
3754
  return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;
3389
3755
  },
@@ -3398,7 +3764,10 @@ var objectProxyTraps = {
3398
3764
  return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;
3399
3765
  },
3400
3766
  ownKeys: function ownKeys(target) {
3401
- if ( globalState.trackingDerivation) warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3767
+ if ( globalState.trackingDerivation) {
3768
+ warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3769
+ }
3770
+
3402
3771
  return getAdm(target).ownKeys_();
3403
3772
  },
3404
3773
  preventExtensions: function preventExtensions(target) {
@@ -3421,7 +3790,10 @@ function registerInterceptor(interceptable, handler) {
3421
3790
  interceptors.push(handler);
3422
3791
  return once(function () {
3423
3792
  var idx = interceptors.indexOf(handler);
3424
- if (idx !== -1) interceptors.splice(idx, 1);
3793
+
3794
+ if (idx !== -1) {
3795
+ interceptors.splice(idx, 1);
3796
+ }
3425
3797
  });
3426
3798
  }
3427
3799
  function interceptChange(interceptable, change) {
@@ -3433,8 +3805,14 @@ function interceptChange(interceptable, change) {
3433
3805
 
3434
3806
  for (var i = 0, l = interceptors.length; i < l; i++) {
3435
3807
  change = interceptors[i](change);
3436
- if (change && !change.type) die(14);
3437
- if (!change) break;
3808
+
3809
+ if (change && !change.type) {
3810
+ die(14);
3811
+ }
3812
+
3813
+ if (!change) {
3814
+ break;
3815
+ }
3438
3816
  }
3439
3817
 
3440
3818
  return change;
@@ -3451,13 +3829,20 @@ function registerListener(listenable, handler) {
3451
3829
  listeners.push(handler);
3452
3830
  return once(function () {
3453
3831
  var idx = listeners.indexOf(handler);
3454
- if (idx !== -1) listeners.splice(idx, 1);
3832
+
3833
+ if (idx !== -1) {
3834
+ listeners.splice(idx, 1);
3835
+ }
3455
3836
  });
3456
3837
  }
3457
3838
  function notifyListeners(listenable, change) {
3458
3839
  var prevU = untrackedStart();
3459
3840
  var listeners = listenable.changeListeners_;
3460
- if (!listeners) return;
3841
+
3842
+ if (!listeners) {
3843
+ return;
3844
+ }
3845
+
3461
3846
  listeners = listeners.slice();
3462
3847
 
3463
3848
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -3494,8 +3879,13 @@ function makeObservable(target, annotations, options) {
3494
3879
  var keysSymbol = /*#__PURE__*/Symbol("mobx-keys");
3495
3880
  function makeAutoObservable(target, overrides, options) {
3496
3881
  {
3497
- if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3498
- if (isObservableObject(target)) die("makeAutoObservable can only be used on objects not already made observable");
3882
+ if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {
3883
+ die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3884
+ }
3885
+
3886
+ if (isObservableObject(target)) {
3887
+ die("makeAutoObservable can only be used on objects not already made observable");
3888
+ }
3499
3889
  } // Optimization: avoid visiting protos
3500
3890
  // Assumes that annotation.make_/.extend_ works the same for plain objects
3501
3891
 
@@ -3536,8 +3926,14 @@ var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/8
3536
3926
  var arrayTraps = {
3537
3927
  get: function get(target, name) {
3538
3928
  var adm = target[$mobx];
3539
- if (name === $mobx) return adm;
3540
- if (name === "length") return adm.getArrayLength_();
3929
+
3930
+ if (name === $mobx) {
3931
+ return adm;
3932
+ }
3933
+
3934
+ if (name === "length") {
3935
+ return adm.getArrayLength_();
3936
+ }
3541
3937
 
3542
3938
  if (typeof name === "string" && !isNaN(name)) {
3543
3939
  return adm.get_(parseInt(name));
@@ -3598,12 +3994,18 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3598
3994
  var _proto = ObservableArrayAdministration.prototype;
3599
3995
 
3600
3996
  _proto.dehanceValue_ = function dehanceValue_(value) {
3601
- if (this.dehancer !== undefined) return this.dehancer(value);
3997
+ if (this.dehancer !== undefined) {
3998
+ return this.dehancer(value);
3999
+ }
4000
+
3602
4001
  return value;
3603
4002
  };
3604
4003
 
3605
4004
  _proto.dehanceValues_ = function dehanceValues_(values) {
3606
- if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer);
4005
+ if (this.dehancer !== undefined && values.length > 0) {
4006
+ return values.map(this.dehancer);
4007
+ }
4008
+
3607
4009
  return values;
3608
4010
  };
3609
4011
 
@@ -3639,9 +4041,15 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3639
4041
  };
3640
4042
 
3641
4043
  _proto.setArrayLength_ = function setArrayLength_(newLength) {
3642
- if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) die("Out of range: " + newLength);
4044
+ if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) {
4045
+ die("Out of range: " + newLength);
4046
+ }
4047
+
3643
4048
  var currentLength = this.values_.length;
3644
- if (newLength === currentLength) return;else if (newLength > currentLength) {
4049
+
4050
+ if (newLength === currentLength) {
4051
+ return;
4052
+ } else if (newLength > currentLength) {
3645
4053
  var newItems = new Array(newLength - currentLength);
3646
4054
 
3647
4055
  for (var i = 0; i < newLength - currentLength; i++) {
@@ -3650,13 +4058,21 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3650
4058
 
3651
4059
 
3652
4060
  this.spliceWithArray_(currentLength, 0, newItems);
3653
- } else this.spliceWithArray_(newLength, currentLength - newLength);
4061
+ } else {
4062
+ this.spliceWithArray_(newLength, currentLength - newLength);
4063
+ }
3654
4064
  };
3655
4065
 
3656
4066
  _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {
3657
- if (oldLength !== this.lastKnownLength_) die(16);
4067
+ if (oldLength !== this.lastKnownLength_) {
4068
+ die(16);
4069
+ }
4070
+
3658
4071
  this.lastKnownLength_ += delta;
3659
- if (this.legacyMode_ && delta > 0) reserveArrayBuffer(oldLength + delta + 1);
4072
+
4073
+ if (this.legacyMode_ && delta > 0) {
4074
+ reserveArrayBuffer(oldLength + delta + 1);
4075
+ }
3660
4076
  };
3661
4077
 
3662
4078
  _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {
@@ -3664,9 +4080,26 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3664
4080
 
3665
4081
  checkIfStateModificationsAreAllowed(this.atom_);
3666
4082
  var length = this.values_.length;
3667
- if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index);
3668
- 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));
3669
- if (newItems === undefined) newItems = EMPTY_ARRAY;
4083
+
4084
+ if (index === undefined) {
4085
+ index = 0;
4086
+ } else if (index > length) {
4087
+ index = length;
4088
+ } else if (index < 0) {
4089
+ index = Math.max(0, length + index);
4090
+ }
4091
+
4092
+ if (arguments.length === 1) {
4093
+ deleteCount = length - index;
4094
+ } else if (deleteCount === undefined || deleteCount === null) {
4095
+ deleteCount = 0;
4096
+ } else {
4097
+ deleteCount = Math.max(0, Math.min(deleteCount, length - index));
4098
+ }
4099
+
4100
+ if (newItems === undefined) {
4101
+ newItems = EMPTY_ARRAY;
4102
+ }
3670
4103
 
3671
4104
  if (hasInterceptors(this)) {
3672
4105
  var change = interceptChange(this, {
@@ -3676,7 +4109,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3676
4109
  removedCount: deleteCount,
3677
4110
  added: newItems
3678
4111
  });
3679
- if (!change) return EMPTY_ARRAY;
4112
+
4113
+ if (!change) {
4114
+ return EMPTY_ARRAY;
4115
+ }
4116
+
3680
4117
  deleteCount = change.removedCount;
3681
4118
  newItems = change.added;
3682
4119
  }
@@ -3691,7 +4128,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3691
4128
  }
3692
4129
 
3693
4130
  var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
3694
- if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice_(index, newItems, res);
4131
+
4132
+ if (deleteCount !== 0 || newItems.length !== 0) {
4133
+ this.notifyArraySplice_(index, newItems, res);
4134
+ }
4135
+
3695
4136
  return this.dehanceValues_(res);
3696
4137
  };
3697
4138
 
@@ -3734,10 +4175,19 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3734
4175
  } : 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
3735
4176
  // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
3736
4177
 
3737
- if ( notifySpy) spyReportStart(change);
4178
+ if ( notifySpy) {
4179
+ spyReportStart(change);
4180
+ }
4181
+
3738
4182
  this.atom_.reportChanged();
3739
- if (notify) notifyListeners(this, change);
3740
- if ( notifySpy) spyReportEnd();
4183
+
4184
+ if (notify) {
4185
+ notifyListeners(this, change);
4186
+ }
4187
+
4188
+ if ( notifySpy) {
4189
+ spyReportEnd();
4190
+ }
3741
4191
  };
3742
4192
 
3743
4193
  _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {
@@ -3754,11 +4204,20 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3754
4204
  removedCount: removed.length,
3755
4205
  addedCount: added.length
3756
4206
  } : null;
3757
- if ( notifySpy) spyReportStart(change);
4207
+
4208
+ if ( notifySpy) {
4209
+ spyReportStart(change);
4210
+ }
4211
+
3758
4212
  this.atom_.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
3759
4213
 
3760
- if (notify) notifyListeners(this, change);
3761
- if ( notifySpy) spyReportEnd();
4214
+ if (notify) {
4215
+ notifyListeners(this, change);
4216
+ }
4217
+
4218
+ if ( notifySpy) {
4219
+ spyReportEnd();
4220
+ }
3762
4221
  };
3763
4222
 
3764
4223
  _proto.get_ = function get_(index) {
@@ -3785,7 +4244,11 @@ var ObservableArrayAdministration = /*#__PURE__*/function () {
3785
4244
  index: index,
3786
4245
  newValue: newValue
3787
4246
  });
3788
- if (!change) return;
4247
+
4248
+ if (!change) {
4249
+ return;
4250
+ }
4251
+
3789
4252
  newValue = change.newValue;
3790
4253
  }
3791
4254
 
@@ -4069,7 +4532,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4069
4532
  _proto.has = function has(key) {
4070
4533
  var _this2 = this;
4071
4534
 
4072
- if (!globalState.trackingDerivation) return this.has_(key);
4535
+ if (!globalState.trackingDerivation) {
4536
+ return this.has_(key);
4537
+ }
4538
+
4073
4539
  var entry = this.hasMap_.get(key);
4074
4540
 
4075
4541
  if (!entry) {
@@ -4093,7 +4559,11 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4093
4559
  newValue: value,
4094
4560
  name: key
4095
4561
  });
4096
- if (!change) return this;
4562
+
4563
+ if (!change) {
4564
+ return this;
4565
+ }
4566
+
4097
4567
  value = change.newValue;
4098
4568
  }
4099
4569
 
@@ -4117,7 +4587,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4117
4587
  object: this,
4118
4588
  name: key
4119
4589
  });
4120
- if (!change) return false;
4590
+
4591
+ if (!change) {
4592
+ return false;
4593
+ }
4121
4594
  }
4122
4595
 
4123
4596
  if (this.has_(key)) {
@@ -4133,7 +4606,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4133
4606
  name: key
4134
4607
  } : null;
4135
4608
 
4136
- if ( notifySpy) spyReportStart(_change); // TODO fix type
4609
+ if ( notifySpy) {
4610
+ spyReportStart(_change);
4611
+ } // TODO fix type
4612
+
4137
4613
 
4138
4614
  transaction(function () {
4139
4615
  var _this3$hasMap_$get;
@@ -4148,8 +4624,15 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4148
4624
 
4149
4625
  _this3.data_["delete"](key);
4150
4626
  });
4151
- if (notify) notifyListeners(this, _change);
4152
- if ( notifySpy) spyReportEnd();
4627
+
4628
+ if (notify) {
4629
+ notifyListeners(this, _change);
4630
+ }
4631
+
4632
+ if ( notifySpy) {
4633
+ spyReportEnd();
4634
+ }
4635
+
4153
4636
  return true;
4154
4637
  }
4155
4638
 
@@ -4172,11 +4655,21 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4172
4655
  name: key,
4173
4656
  newValue: newValue
4174
4657
  } : null;
4175
- if ( notifySpy) spyReportStart(change); // TODO fix type
4658
+
4659
+ if ( notifySpy) {
4660
+ spyReportStart(change);
4661
+ } // TODO fix type
4662
+
4176
4663
 
4177
4664
  observable.setNewValue_(newValue);
4178
- if (notify) notifyListeners(this, change);
4179
- if ( notifySpy) spyReportEnd();
4665
+
4666
+ if (notify) {
4667
+ notifyListeners(this, change);
4668
+ }
4669
+
4670
+ if ( notifySpy) {
4671
+ spyReportEnd();
4672
+ }
4180
4673
  }
4181
4674
  };
4182
4675
 
@@ -4207,14 +4700,26 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4207
4700
  name: key,
4208
4701
  newValue: newValue
4209
4702
  } : null;
4210
- if ( notifySpy) spyReportStart(change); // TODO fix type
4211
4703
 
4212
- if (notify) notifyListeners(this, change);
4213
- if ( notifySpy) spyReportEnd();
4704
+ if ( notifySpy) {
4705
+ spyReportStart(change);
4706
+ } // TODO fix type
4707
+
4708
+
4709
+ if (notify) {
4710
+ notifyListeners(this, change);
4711
+ }
4712
+
4713
+ if ( notifySpy) {
4714
+ spyReportEnd();
4715
+ }
4214
4716
  };
4215
4717
 
4216
4718
  _proto.get = function get(key) {
4217
- if (this.has(key)) return this.dehanceValue_(this.data_.get(key).get());
4719
+ if (this.has(key)) {
4720
+ return this.dehanceValue_(this.data_.get(key).get());
4721
+ }
4722
+
4218
4723
  return this.dehanceValue_(undefined);
4219
4724
  };
4220
4725
 
@@ -4288,18 +4793,27 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4288
4793
  }
4289
4794
 
4290
4795
  transaction(function () {
4291
- if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) {
4292
- return _this5.set(key, other[key]);
4293
- });else if (Array.isArray(other)) other.forEach(function (_ref) {
4294
- var key = _ref[0],
4295
- value = _ref[1];
4296
- return _this5.set(key, value);
4297
- });else if (isES6Map(other)) {
4298
- if (other.constructor !== Map) die(19, other);
4796
+ if (isPlainObject(other)) {
4797
+ getPlainObjectKeys(other).forEach(function (key) {
4798
+ return _this5.set(key, other[key]);
4799
+ });
4800
+ } else if (Array.isArray(other)) {
4801
+ other.forEach(function (_ref) {
4802
+ var key = _ref[0],
4803
+ value = _ref[1];
4804
+ return _this5.set(key, value);
4805
+ });
4806
+ } else if (isES6Map(other)) {
4807
+ if (other.constructor !== Map) {
4808
+ die(19, other);
4809
+ }
4810
+
4299
4811
  other.forEach(function (value, key) {
4300
4812
  return _this5.set(key, value);
4301
4813
  });
4302
- } else if (other !== null && other !== undefined) die(20, other);
4814
+ } else if (other !== null && other !== undefined) {
4815
+ die(20, other);
4816
+ }
4303
4817
  });
4304
4818
  return this;
4305
4819
  };
@@ -4430,7 +4944,10 @@ var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4430
4944
  * for callback details
4431
4945
  */
4432
4946
  _proto.observe_ = function observe_(listener, fireImmediately) {
4433
- if ( fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with maps.");
4947
+ if ( fireImmediately === true) {
4948
+ die("`observe` doesn't support fireImmediately=true in combination with maps.");
4949
+ }
4950
+
4434
4951
  return registerListener(this, listener);
4435
4952
  };
4436
4953
 
@@ -4555,8 +5072,12 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4555
5072
  object: this,
4556
5073
  newValue: value
4557
5074
  });
4558
- if (!change) return this; // ideally, value = change.value would be done here, so that values can be
5075
+
5076
+ if (!change) {
5077
+ return this;
5078
+ } // ideally, value = change.value would be done here, so that values can be
4559
5079
  // changed by interceptor. Same applies for other Set and Map api's.
5080
+
4560
5081
  }
4561
5082
 
4562
5083
  if (!this.has(value)) {
@@ -4576,9 +5097,17 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4576
5097
  newValue: value
4577
5098
  } : null;
4578
5099
 
4579
- if (notifySpy && "development" !== "production") spyReportStart(_change);
4580
- if (notify) notifyListeners(this, _change);
4581
- if (notifySpy && "development" !== "production") spyReportEnd();
5100
+ if (notifySpy && "development" !== "production") {
5101
+ spyReportStart(_change);
5102
+ }
5103
+
5104
+ if (notify) {
5105
+ notifyListeners(this, _change);
5106
+ }
5107
+
5108
+ if (notifySpy && "development" !== "production") {
5109
+ spyReportEnd();
5110
+ }
4582
5111
  }
4583
5112
 
4584
5113
  return this;
@@ -4593,7 +5122,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4593
5122
  object: this,
4594
5123
  oldValue: value
4595
5124
  });
4596
- if (!change) return false;
5125
+
5126
+ if (!change) {
5127
+ return false;
5128
+ }
4597
5129
  }
4598
5130
 
4599
5131
  if (this.has(value)) {
@@ -4608,14 +5140,24 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4608
5140
  oldValue: value
4609
5141
  } : null;
4610
5142
 
4611
- if (notifySpy && "development" !== "production") spyReportStart(_change2);
5143
+ if (notifySpy && "development" !== "production") {
5144
+ spyReportStart(_change2);
5145
+ }
5146
+
4612
5147
  transaction(function () {
4613
5148
  _this3.atom_.reportChanged();
4614
5149
 
4615
5150
  _this3.data_["delete"](value);
4616
5151
  });
4617
- if (notify) notifyListeners(this, _change2);
4618
- if (notifySpy && "development" !== "production") spyReportEnd();
5152
+
5153
+ if (notify) {
5154
+ notifyListeners(this, _change2);
5155
+ }
5156
+
5157
+ if (notifySpy && "development" !== "production") {
5158
+ spyReportEnd();
5159
+ }
5160
+
4619
5161
  return true;
4620
5162
  }
4621
5163
 
@@ -4695,7 +5237,10 @@ var ObservableSet = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTa
4695
5237
 
4696
5238
  _proto.observe_ = function observe_(listener, fireImmediately) {
4697
5239
  // ... 'fireImmediately' could also be true?
4698
- if ( fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with sets.");
5240
+ if ( fireImmediately === true) {
5241
+ die("`observe` doesn't support fireImmediately=true in combination with sets.");
5242
+ }
5243
+
4699
5244
  return registerListener(this, listener);
4700
5245
  };
4701
5246
 
@@ -4797,7 +5342,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4797
5342
  name: key,
4798
5343
  newValue: newValue
4799
5344
  });
4800
- if (!change) return null;
5345
+
5346
+ if (!change) {
5347
+ return null;
5348
+ }
5349
+
4801
5350
  newValue = change.newValue;
4802
5351
  }
4803
5352
 
@@ -4817,10 +5366,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4817
5366
  newValue: newValue
4818
5367
  } : null;
4819
5368
 
4820
- if ( notifySpy) spyReportStart(_change);
5369
+ if ( notifySpy) {
5370
+ spyReportStart(_change);
5371
+ }
4821
5372
  observable.setNewValue_(newValue);
4822
- if (notify) notifyListeners(this, _change);
4823
- if ( notifySpy) spyReportEnd();
5373
+
5374
+ if (notify) {
5375
+ notifyListeners(this, _change);
5376
+ }
5377
+
5378
+ if ( notifySpy) {
5379
+ spyReportEnd();
5380
+ }
4824
5381
  }
4825
5382
 
4826
5383
  return true;
@@ -4929,12 +5486,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
4929
5486
 
4930
5487
  if (descriptor) {
4931
5488
  var outcome = annotation.make_(this, key, descriptor, source);
5489
+
4932
5490
  if (outcome === 0
4933
5491
  /* Cancel */
4934
- ) return;
5492
+ ) {
5493
+ return;
5494
+ }
5495
+
4935
5496
  if (outcome === 1
4936
5497
  /* Break */
4937
- ) break;
5498
+ ) {
5499
+ break;
5500
+ }
4938
5501
  }
4939
5502
 
4940
5503
  source = Object.getPrototypeOf(source);
@@ -5004,7 +5567,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5004
5567
  type: ADD,
5005
5568
  newValue: descriptor.value
5006
5569
  });
5007
- if (!change) return null;
5570
+
5571
+ if (!change) {
5572
+ return null;
5573
+ }
5574
+
5008
5575
  var newValue = change.newValue;
5009
5576
 
5010
5577
  if (descriptor.value !== newValue) {
@@ -5056,7 +5623,11 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5056
5623
  type: ADD,
5057
5624
  newValue: value
5058
5625
  });
5059
- if (!change) return null;
5626
+
5627
+ if (!change) {
5628
+ return null;
5629
+ }
5630
+
5060
5631
  value = change.newValue;
5061
5632
  }
5062
5633
 
@@ -5111,7 +5682,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5111
5682
  type: ADD,
5112
5683
  newValue: undefined
5113
5684
  });
5114
- if (!change) return null;
5685
+
5686
+ if (!change) {
5687
+ return null;
5688
+ }
5115
5689
  }
5116
5690
 
5117
5691
  options.name || (options.name = "development" !== "production" ? this.name_ + "." + key.toString() : "ObservableObject.key");
@@ -5167,7 +5741,9 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5167
5741
  type: REMOVE
5168
5742
  }); // Cancelled
5169
5743
 
5170
- if (!change) return null;
5744
+ if (!change) {
5745
+ return null;
5746
+ }
5171
5747
  } // Delete
5172
5748
 
5173
5749
 
@@ -5228,9 +5804,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5228
5804
  oldValue: value,
5229
5805
  name: key
5230
5806
  };
5231
- if ("development" !== "production" && notifySpy) spyReportStart(_change2);
5232
- if (notify) notifyListeners(this, _change2);
5233
- if ("development" !== "production" && notifySpy) spyReportEnd();
5807
+
5808
+ if ("development" !== "production" && notifySpy) {
5809
+ spyReportStart(_change2);
5810
+ }
5811
+
5812
+ if (notify) {
5813
+ notifyListeners(this, _change2);
5814
+ }
5815
+
5816
+ if ("development" !== "production" && notifySpy) {
5817
+ spyReportEnd();
5818
+ }
5234
5819
  }
5235
5820
  } finally {
5236
5821
  endBatch();
@@ -5246,7 +5831,10 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5246
5831
  ;
5247
5832
 
5248
5833
  _proto.observe_ = function observe_(callback, fireImmediately) {
5249
- if ( fireImmediately === true) die("`observe` doesn't support the fire immediately property for observable objects.");
5834
+ if ( fireImmediately === true) {
5835
+ die("`observe` doesn't support the fire immediately property for observable objects.");
5836
+ }
5837
+
5250
5838
  return registerListener(this, callback);
5251
5839
  };
5252
5840
 
@@ -5269,9 +5857,18 @@ var ObservableObjectAdministration = /*#__PURE__*/function () {
5269
5857
  name: key,
5270
5858
  newValue: value
5271
5859
  } : null;
5272
- if ( notifySpy) spyReportStart(change);
5273
- if (notify) notifyListeners(this, change);
5274
- if ( notifySpy) spyReportEnd();
5860
+
5861
+ if ( notifySpy) {
5862
+ spyReportStart(change);
5863
+ }
5864
+
5865
+ if (notify) {
5866
+ notifyListeners(this, change);
5867
+ }
5868
+
5869
+ if ( notifySpy) {
5870
+ spyReportEnd();
5871
+ }
5275
5872
  }
5276
5873
 
5277
5874
  (_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
@@ -5312,7 +5909,10 @@ function asObservableObject(target, options) {
5312
5909
  return target;
5313
5910
  }
5314
5911
 
5315
- if ( !Object.isExtensible(target)) die("Cannot make the designated object observable; it is not extensible");
5912
+ if ( !Object.isExtensible(target)) {
5913
+ die("Cannot make the designated object observable; it is not extensible");
5914
+ }
5915
+
5316
5916
  var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : (isPlainObject(target) ? "ObservableObject" : target.constructor.name) + "@" + getNextId() ;
5317
5917
  var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));
5318
5918
  addHiddenProp(target, $mobx, adm);
@@ -5469,7 +6069,6 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5469
6069
  var nextIndex = 0;
5470
6070
  return makeIterable({
5471
6071
  next: function next() {
5472
- // @ts-ignore
5473
6072
  return nextIndex < self.length ? {
5474
6073
  value: self[nextIndex++],
5475
6074
  done: false
@@ -5502,7 +6101,10 @@ var LegacyObservableArray = /*#__PURE__*/function (_StubArray, _Symbol$toStringT
5502
6101
  Object.entries(arrayExtensions).forEach(function (_ref) {
5503
6102
  var prop = _ref[0],
5504
6103
  fn = _ref[1];
5505
- if (prop !== "concat") addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6104
+
6105
+ if (prop !== "concat") {
6106
+ addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6107
+ }
5506
6108
  });
5507
6109
 
5508
6110
  function createArrayEntryDescriptor(index) {
@@ -5539,7 +6141,10 @@ function createLegacyArray(initialValues, enhancer, name) {
5539
6141
  function getAtom(thing, property) {
5540
6142
  if (typeof thing === "object" && thing !== null) {
5541
6143
  if (isObservableArray(thing)) {
5542
- if (property !== undefined) die(23);
6144
+ if (property !== undefined) {
6145
+ die(23);
6146
+ }
6147
+
5543
6148
  return thing[$mobx].atom_;
5544
6149
  }
5545
6150
 
@@ -5548,18 +6153,31 @@ function getAtom(thing, property) {
5548
6153
  }
5549
6154
 
5550
6155
  if (isObservableMap(thing)) {
5551
- if (property === undefined) return thing.keysAtom_;
6156
+ if (property === undefined) {
6157
+ return thing.keysAtom_;
6158
+ }
6159
+
5552
6160
  var observable = thing.data_.get(property) || thing.hasMap_.get(property);
5553
- if (!observable) die(25, property, getDebugName(thing));
6161
+
6162
+ if (!observable) {
6163
+ die(25, property, getDebugName(thing));
6164
+ }
6165
+
5554
6166
  return observable;
5555
6167
  }
5556
6168
 
6169
+
5557
6170
  if (isObservableObject(thing)) {
5558
- if (!property) return die(26);
6171
+ if (!property) {
6172
+ return die(26);
6173
+ }
5559
6174
 
5560
6175
  var _observable = thing[$mobx].values_.get(property);
5561
6176
 
5562
- if (!_observable) die(27, property, getDebugName(thing));
6177
+ if (!_observable) {
6178
+ die(27, property, getDebugName(thing));
6179
+ }
6180
+
5563
6181
  return _observable;
5564
6182
  }
5565
6183
 
@@ -5576,11 +6194,26 @@ function getAtom(thing, property) {
5576
6194
  die(28);
5577
6195
  }
5578
6196
  function getAdministration(thing, property) {
5579
- if (!thing) die(29);
5580
- if (property !== undefined) return getAdministration(getAtom(thing, property));
5581
- if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing;
5582
- if (isObservableMap(thing) || isObservableSet(thing)) return thing;
5583
- if (thing[$mobx]) return thing[$mobx];
6197
+ if (!thing) {
6198
+ die(29);
6199
+ }
6200
+
6201
+ if (property !== undefined) {
6202
+ return getAdministration(getAtom(thing, property));
6203
+ }
6204
+
6205
+ if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
6206
+ return thing;
6207
+ }
6208
+
6209
+ if (isObservableMap(thing) || isObservableSet(thing)) {
6210
+ return thing;
6211
+ }
6212
+
6213
+ if (thing[$mobx]) {
6214
+ return thing[$mobx];
6215
+ }
6216
+
5584
6217
  die(24, thing);
5585
6218
  }
5586
6219
  function getDebugName(thing, property) {
@@ -5613,17 +6246,33 @@ function deepEqual(a, b, depth) {
5613
6246
  function eq(a, b, depth, aStack, bStack) {
5614
6247
  // Identical objects are equal. `0 === -0`, but they aren't identical.
5615
6248
  // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
5616
- if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison).
6249
+ if (a === b) {
6250
+ return a !== 0 || 1 / a === 1 / b;
6251
+ } // `null` or `undefined` only equal to itself (strict comparison).
6252
+
6253
+
6254
+ if (a == null || b == null) {
6255
+ return false;
6256
+ } // `NaN`s are equivalent, but non-reflexive.
5617
6257
 
5618
- if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive.
5619
6258
 
5620
- if (a !== a) return b !== b; // Exhaust primitive checks
6259
+ if (a !== a) {
6260
+ return b !== b;
6261
+ } // Exhaust primitive checks
6262
+
5621
6263
 
5622
6264
  var type = typeof a;
5623
- if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names.
6265
+
6266
+ if (type !== "function" && type !== "object" && typeof b != "object") {
6267
+ return false;
6268
+ } // Compare `[[Class]]` names.
6269
+
5624
6270
 
5625
6271
  var className = toString.call(a);
5626
- if (className !== toString.call(b)) return false;
6272
+
6273
+ if (className !== toString.call(b)) {
6274
+ return false;
6275
+ }
5627
6276
 
5628
6277
  switch (className) {
5629
6278
  // Strings, numbers, regular expressions, dates, and booleans are compared by value.
@@ -5637,7 +6286,10 @@ function eq(a, b, depth, aStack, bStack) {
5637
6286
  case "[object Number]":
5638
6287
  // `NaN`s are equivalent, but non-reflexive.
5639
6288
  // Object(NaN) is equivalent to NaN.
5640
- if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values.
6289
+ if (+a !== +a) {
6290
+ return +b !== +b;
6291
+ } // An `egal` comparison is performed for other numeric values.
6292
+
5641
6293
 
5642
6294
  return +a === 0 ? 1 / +a === 1 / b : +a === +b;
5643
6295
 
@@ -5668,9 +6320,12 @@ function eq(a, b, depth, aStack, bStack) {
5668
6320
  var areArrays = className === "[object Array]";
5669
6321
 
5670
6322
  if (!areArrays) {
5671
- if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6323
+ if (typeof a != "object" || typeof b != "object") {
6324
+ return false;
6325
+ } // Objects with different constructors are not equivalent, but `Object`s or `Array`s
5672
6326
  // from different frames are.
5673
6327
 
6328
+
5674
6329
  var aCtor = a.constructor,
5675
6330
  bCtor = b.constructor;
5676
6331
 
@@ -5696,7 +6351,9 @@ function eq(a, b, depth, aStack, bStack) {
5696
6351
  while (length--) {
5697
6352
  // Linear search. Performance is inversely proportional to the number of
5698
6353
  // unique nested structures.
5699
- if (aStack[length] === a) return bStack[length] === b;
6354
+ if (aStack[length] === a) {
6355
+ return bStack[length] === b;
6356
+ }
5700
6357
  } // Add the first object to the stack of traversed objects.
5701
6358
 
5702
6359
 
@@ -5706,10 +6363,16 @@ function eq(a, b, depth, aStack, bStack) {
5706
6363
  if (areArrays) {
5707
6364
  // Compare array lengths to determine if a deep comparison is necessary.
5708
6365
  length = a.length;
5709
- if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties.
6366
+
6367
+ if (length !== b.length) {
6368
+ return false;
6369
+ } // Deep compare the contents, ignoring non-numeric properties.
6370
+
5710
6371
 
5711
6372
  while (length--) {
5712
- if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false;
6373
+ if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {
6374
+ return false;
6375
+ }
5713
6376
  }
5714
6377
  } else {
5715
6378
  // Deep compare objects.
@@ -5717,12 +6380,17 @@ function eq(a, b, depth, aStack, bStack) {
5717
6380
  var key;
5718
6381
  length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
5719
6382
 
5720
- if (Object.keys(b).length !== length) return false;
6383
+ if (Object.keys(b).length !== length) {
6384
+ return false;
6385
+ }
5721
6386
 
5722
6387
  while (length--) {
5723
6388
  // Deep compare each member
5724
6389
  key = keys[length];
5725
- if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false;
6390
+
6391
+ if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
6392
+ return false;
6393
+ }
5726
6394
  }
5727
6395
  } // Remove the first object from the stack of traversed objects.
5728
6396
 
@@ -5733,9 +6401,18 @@ function eq(a, b, depth, aStack, bStack) {
5733
6401
  }
5734
6402
 
5735
6403
  function unwrap(a) {
5736
- if (isObservableArray(a)) return a.slice();
5737
- if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries());
5738
- if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries());
6404
+ if (isObservableArray(a)) {
6405
+ return a.slice();
6406
+ }
6407
+
6408
+ if (isES6Map(a) || isObservableMap(a)) {
6409
+ return Array.from(a.entries());
6410
+ }
6411
+
6412
+ if (isES6Set(a) || isObservableSet(a)) {
6413
+ return Array.from(a.entries());
6414
+ }
6415
+
5739
6416
  return a;
5740
6417
  }
5741
6418