mobx 6.3.10 → 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 (64) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +1 -0
  3. package/dist/api/tojs.d.ts +4 -1
  4. package/dist/errors.d.ts +2 -2
  5. package/dist/mobx.cjs.development.js +995 -304
  6. package/dist/mobx.cjs.development.js.map +1 -1
  7. package/dist/mobx.cjs.production.min.js +1 -1
  8. package/dist/mobx.cjs.production.min.js.map +1 -1
  9. package/dist/mobx.esm.development.js +995 -304
  10. package/dist/mobx.esm.development.js.map +1 -1
  11. package/dist/mobx.esm.js +1010 -307
  12. package/dist/mobx.esm.js.map +1 -1
  13. package/dist/mobx.esm.production.min.js +1 -1
  14. package/dist/mobx.esm.production.min.js.map +1 -1
  15. package/dist/mobx.umd.development.js +995 -304
  16. package/dist/mobx.umd.development.js.map +1 -1
  17. package/dist/mobx.umd.production.min.js +1 -1
  18. package/dist/mobx.umd.production.min.js.map +1 -1
  19. package/dist/types/observablemap.d.ts +2 -2
  20. package/dist/utils/utils.d.ts +1 -1
  21. package/package.json +1 -1
  22. package/src/api/action.ts +8 -3
  23. package/src/api/annotation.ts +1 -2
  24. package/src/api/autorun.ts +22 -8
  25. package/src/api/computed.ts +5 -2
  26. package/src/api/configure.ts +6 -2
  27. package/src/api/extendobservable.ts +11 -5
  28. package/src/api/extras.ts +4 -2
  29. package/src/api/flow.ts +11 -4
  30. package/src/api/intercept-read.ts +4 -2
  31. package/src/api/intercept.ts +5 -2
  32. package/src/api/iscomputed.ts +10 -4
  33. package/src/api/isobservable.ts +10 -4
  34. package/src/api/makeObservable.ts +4 -2
  35. package/src/api/object-api.ts +30 -16
  36. package/src/api/observable.ts +23 -9
  37. package/src/api/observe.ts +4 -2
  38. package/src/api/tojs.ts +11 -4
  39. package/src/api/trace.ts +6 -2
  40. package/src/api/when.ts +12 -5
  41. package/src/core/action.ts +8 -3
  42. package/src/core/computedvalue.ts +29 -9
  43. package/src/core/derivation.ts +25 -9
  44. package/src/core/globalstate.ts +18 -7
  45. package/src/core/observable.ts +14 -5
  46. package/src/core/reaction.ts +15 -6
  47. package/src/core/spy.ts +20 -7
  48. package/src/errors.ts +2 -2
  49. package/src/types/actionannotation.ts +2 -2
  50. package/src/types/dynamicobject.ts +10 -4
  51. package/src/types/flowannotation.ts +14 -4
  52. package/src/types/intercept-utils.ts +9 -3
  53. package/src/types/legacyobservablearray.ts +5 -3
  54. package/src/types/listen-utils.ts +6 -2
  55. package/src/types/modifiers.ts +39 -14
  56. package/src/types/observablearray.ts +78 -30
  57. package/src/types/observablemap.ts +65 -26
  58. package/src/types/observableobject.ts +52 -18
  59. package/src/types/observableset.ts +29 -10
  60. package/src/types/observablevalue.ts +13 -5
  61. package/src/types/type-utils.ts +33 -11
  62. package/src/utils/comparer.ts +4 -4
  63. package/src/utils/eq.ts +45 -15
  64. package/src/utils/utils.ts +42 -20
@@ -29,9 +29,9 @@
29
29
  10: "'has()' can only be used on observable objects, arrays and maps",
30
30
  11: "'get()' can only be used on observable objects, arrays and maps",
31
31
  12: "Invalid annotation",
32
- 13: "Dynamic observable objects cannot be frozen",
32
+ 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)",
33
33
  14: "Intercept handlers should return nothing or a change object",
34
- 15: "Observable arrays cannot be frozen",
34
+ 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)",
35
35
  16: "Modification exception: the internal structure of an observable array was changed.",
36
36
  17: function _(index, length) {
37
37
  return "[mobx.array] Index out of bounds, " + index + " is larger than " + length;
@@ -145,7 +145,10 @@
145
145
  function once(func) {
146
146
  var invoked = false;
147
147
  return function () {
148
- if (invoked) return;
148
+ if (invoked) {
149
+ return;
150
+ }
151
+
149
152
  invoked = true;
150
153
  return func.apply(this, arguments);
151
154
  };
@@ -170,17 +173,31 @@
170
173
  return value !== null && typeof value === "object";
171
174
  }
172
175
  function isPlainObject(value) {
173
- if (!isObject(value)) return false;
176
+ if (!isObject(value)) {
177
+ return false;
178
+ }
179
+
174
180
  var proto = Object.getPrototypeOf(value);
175
- if (proto == null) return true;
181
+
182
+ if (proto == null) {
183
+ return true;
184
+ }
185
+
176
186
  var protoConstructor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
177
187
  return typeof protoConstructor === "function" && protoConstructor.toString() === plainObjectString;
178
188
  } // https://stackoverflow.com/a/37865170
179
189
 
180
190
  function isGenerator(obj) {
181
191
  var constructor = obj == null ? void 0 : obj.constructor;
182
- if (!constructor) return false;
183
- if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) return true;
192
+
193
+ if (!constructor) {
194
+ return false;
195
+ }
196
+
197
+ if ("GeneratorFunction" === constructor.name || "GeneratorFunction" === constructor.displayName) {
198
+ return true;
199
+ }
200
+
184
201
  return false;
185
202
  }
186
203
  function addHiddenProp(object, propName, value) {
@@ -220,9 +237,16 @@
220
237
  function getPlainObjectKeys(object) {
221
238
  var keys = Object.keys(object); // Not supported in IE, so there are not going to be symbol props anyway...
222
239
 
223
- if (!hasGetOwnPropertySymbols) return keys;
240
+ if (!hasGetOwnPropertySymbols) {
241
+ return keys;
242
+ }
243
+
224
244
  var symbols = Object.getOwnPropertySymbols(object);
225
- if (!symbols.length) return keys;
245
+
246
+ if (!symbols.length) {
247
+ return keys;
248
+ }
249
+
226
250
  return [].concat(keys, symbols.filter(function (s) {
227
251
  return objectPrototype.propertyIsEnumerable.call(object, s);
228
252
  }));
@@ -235,8 +259,14 @@
235
259
  /* istanbul ignore next */
236
260
  Object.getOwnPropertyNames;
237
261
  function stringifyKey(key) {
238
- if (typeof key === "string") return key;
239
- if (typeof key === "symbol") return key.toString();
262
+ if (typeof key === "string") {
263
+ return key;
264
+ }
265
+
266
+ if (typeof key === "symbol") {
267
+ return key.toString();
268
+ }
269
+
240
270
  return new String(key).toString();
241
271
  }
242
272
  function toPrimitive(value) {
@@ -524,7 +554,10 @@
524
554
  }
525
555
 
526
556
  function defaultComparer(a, b) {
527
- if (Object.is) return Object.is(a, b);
557
+ if (Object.is) {
558
+ return Object.is(a, b);
559
+ }
560
+
528
561
  return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
529
562
  }
530
563
 
@@ -537,20 +570,34 @@
537
570
 
538
571
  function deepEnhancer(v, _, name) {
539
572
  // it is an observable already, done
540
- if (isObservable(v)) return v; // something that can be converted and mutated?
573
+ if (isObservable(v)) {
574
+ return v;
575
+ } // something that can be converted and mutated?
541
576
 
542
- if (Array.isArray(v)) return observable.array(v, {
543
- name: name
544
- });
545
- if (isPlainObject(v)) return observable.object(v, undefined, {
546
- name: name
547
- });
548
- if (isES6Map(v)) return observable.map(v, {
549
- name: name
550
- });
551
- if (isES6Set(v)) return observable.set(v, {
552
- name: name
553
- });
577
+
578
+ if (Array.isArray(v)) {
579
+ return observable.array(v, {
580
+ name: name
581
+ });
582
+ }
583
+
584
+ if (isPlainObject(v)) {
585
+ return observable.object(v, undefined, {
586
+ name: name
587
+ });
588
+ }
589
+
590
+ if (isES6Map(v)) {
591
+ return observable.map(v, {
592
+ name: name
593
+ });
594
+ }
595
+
596
+ if (isES6Set(v)) {
597
+ return observable.set(v, {
598
+ name: name
599
+ });
600
+ }
554
601
 
555
602
  if (typeof v === "function" && !isAction(v) && !isFlow(v)) {
556
603
  if (isGenerator(v)) {
@@ -563,33 +610,59 @@
563
610
  return v;
564
611
  }
565
612
  function shallowEnhancer(v, _, name) {
566
- if (v === undefined || v === null) return v;
567
- if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) return v;
568
- if (Array.isArray(v)) return observable.array(v, {
569
- name: name,
570
- deep: false
571
- });
572
- if (isPlainObject(v)) return observable.object(v, undefined, {
573
- name: name,
574
- deep: false
575
- });
576
- if (isES6Map(v)) return observable.map(v, {
577
- name: name,
578
- deep: false
579
- });
580
- if (isES6Set(v)) return observable.set(v, {
581
- name: name,
582
- deep: false
583
- });
584
- die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
613
+ if (v === undefined || v === null) {
614
+ return v;
615
+ }
616
+
617
+ if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) {
618
+ return v;
619
+ }
620
+
621
+ if (Array.isArray(v)) {
622
+ return observable.array(v, {
623
+ name: name,
624
+ deep: false
625
+ });
626
+ }
627
+
628
+ if (isPlainObject(v)) {
629
+ return observable.object(v, undefined, {
630
+ name: name,
631
+ deep: false
632
+ });
633
+ }
634
+
635
+ if (isES6Map(v)) {
636
+ return observable.map(v, {
637
+ name: name,
638
+ deep: false
639
+ });
640
+ }
641
+
642
+ if (isES6Set(v)) {
643
+ return observable.set(v, {
644
+ name: name,
645
+ deep: false
646
+ });
647
+ }
648
+
649
+ {
650
+ die("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets");
651
+ }
585
652
  }
586
653
  function referenceEnhancer(newValue) {
587
654
  // never turn into an observable
588
655
  return newValue;
589
656
  }
590
657
  function refStructEnhancer(v, oldValue) {
591
- if ( isObservable(v)) die("observable.struct should not be used with observable values");
592
- if (deepEqual(v, oldValue)) return oldValue;
658
+ if ( isObservable(v)) {
659
+ die("observable.struct should not be used with observable values");
660
+ }
661
+
662
+ if (deepEqual(v, oldValue)) {
663
+ return oldValue;
664
+ }
665
+
593
666
  return v;
594
667
  }
595
668
 
@@ -737,10 +810,12 @@
737
810
  // bound - must annotate protos to support super.flow()
738
811
 
739
812
 
740
- if ((_this$options_ = this.options_) != null && _this$options_.bound && !isFlow(adm.target_[key])) {
741
- if (this.extend_(adm, key, descriptor, false) === null) return 0
742
- /* Cancel */
743
- ;
813
+ if ((_this$options_ = this.options_) != null && _this$options_.bound && (!hasProp(adm.target_, key) || !isFlow(adm.target_[key]))) {
814
+ if (this.extend_(adm, key, descriptor, false) === null) {
815
+ return 0
816
+ /* Cancel */
817
+ ;
818
+ }
744
819
  }
745
820
 
746
821
  if (isFlow(descriptor.value)) {
@@ -781,16 +856,23 @@
781
856
  }
782
857
 
783
858
  assertFlowDescriptor(adm, annotation, key, descriptor);
784
- var value = descriptor.value;
859
+ var value = descriptor.value; // In case of flow.bound, the descriptor can be from already annotated prototype
860
+
861
+ if (!isFlow(value)) {
862
+ value = flow(value);
863
+ }
785
864
 
786
865
  if (bound) {
787
866
  var _adm$proxy_;
788
867
 
789
- value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_);
868
+ // We do not keep original function around, so we bind the existing flow
869
+ value = value.bind((_adm$proxy_ = adm.proxy_) != null ? _adm$proxy_ : adm.target_); // This is normally set by `flow`, but `bind` returns new function...
870
+
871
+ value.isMobXFlow = true;
790
872
  }
791
873
 
792
874
  return {
793
- value: flow(value),
875
+ value: value,
794
876
  // Non-configurable for classes
795
877
  // prevents accidental field redefinition in subclass
796
878
  configurable: safeDescriptors ? adm.isPlainObject_ : true,
@@ -1024,17 +1106,35 @@
1024
1106
  } // already observable - ignore
1025
1107
 
1026
1108
 
1027
- if (isObservable(v)) return v; // plain object
1109
+ if (isObservable(v)) {
1110
+ return v;
1111
+ } // plain object
1028
1112
 
1029
- if (isPlainObject(v)) return observable.object(v, arg2, arg3); // Array
1030
1113
 
1031
- if (Array.isArray(v)) return observable.array(v, arg2); // Map
1114
+ if (isPlainObject(v)) {
1115
+ return observable.object(v, arg2, arg3);
1116
+ } // Array
1032
1117
 
1033
- if (isES6Map(v)) return observable.map(v, arg2); // Set
1034
1118
 
1035
- if (isES6Set(v)) return observable.set(v, arg2); // other object - ignore
1119
+ if (Array.isArray(v)) {
1120
+ return observable.array(v, arg2);
1121
+ } // Map
1122
+
1123
+
1124
+ if (isES6Map(v)) {
1125
+ return observable.map(v, arg2);
1126
+ } // Set
1127
+
1128
+
1129
+ if (isES6Set(v)) {
1130
+ return observable.set(v, arg2);
1131
+ } // other object - ignore
1132
+
1133
+
1134
+ if (typeof v === "object" && v !== null) {
1135
+ return v;
1136
+ } // anything else
1036
1137
 
1037
- if (typeof v === "object" && v !== null) return v; // anything else
1038
1138
 
1039
1139
  return observable.box(v, arg2);
1040
1140
  }
@@ -1092,8 +1192,13 @@
1092
1192
 
1093
1193
 
1094
1194
  {
1095
- if (!isFunction(arg1)) die("First argument to `computed` should be an expression.");
1096
- if (isFunction(arg2)) die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1195
+ if (!isFunction(arg1)) {
1196
+ die("First argument to `computed` should be an expression.");
1197
+ }
1198
+
1199
+ if (isFunction(arg2)) {
1200
+ die("A setter as second argument is no longer supported, use `{ set: fn }` option instead");
1201
+ }
1097
1202
  }
1098
1203
 
1099
1204
  var opts = isPlainObject(arg2) ? arg2 : {};
@@ -1125,8 +1230,13 @@
1125
1230
  }
1126
1231
 
1127
1232
  {
1128
- if (!isFunction(fn)) die("`action` can only be invoked on functions");
1129
- if (typeof actionName !== "string" || !actionName) die("actions should have valid names, got: '" + actionName + "'");
1233
+ if (!isFunction(fn)) {
1234
+ die("`action` can only be invoked on functions");
1235
+ }
1236
+
1237
+ if (typeof actionName !== "string" || !actionName) {
1238
+ die("actions should have valid names, got: '" + actionName + "'");
1239
+ }
1130
1240
  }
1131
1241
 
1132
1242
  function res() {
@@ -1208,7 +1318,10 @@
1208
1318
  allowStateChangesEnd(runInfo.prevAllowStateChanges_);
1209
1319
  allowStateReadsEnd(runInfo.prevAllowStateReads_);
1210
1320
  endBatch();
1211
- if (runInfo.runAsAction_) untrackedEnd(runInfo.prevDerivation_);
1321
+
1322
+ if (runInfo.runAsAction_) {
1323
+ untrackedEnd(runInfo.prevDerivation_);
1324
+ }
1212
1325
 
1213
1326
  if ( runInfo.notifySpy_) {
1214
1327
  spyReportEnd({
@@ -1288,7 +1401,10 @@
1288
1401
  var _proto = ObservableValue.prototype;
1289
1402
 
1290
1403
  _proto.dehanceValue = function dehanceValue(value) {
1291
- if (this.dehancer !== undefined) return this.dehancer(value);
1404
+ if (this.dehancer !== undefined) {
1405
+ return this.dehancer(value);
1406
+ }
1407
+
1292
1408
  return value;
1293
1409
  };
1294
1410
 
@@ -1311,7 +1427,10 @@
1311
1427
  }
1312
1428
 
1313
1429
  this.setNewValue_(newValue);
1314
- if ( notifySpy) spyReportEnd();
1430
+
1431
+ if ( notifySpy) {
1432
+ spyReportEnd();
1433
+ }
1315
1434
  }
1316
1435
  };
1317
1436
 
@@ -1324,7 +1443,11 @@
1324
1443
  type: UPDATE,
1325
1444
  newValue: newValue
1326
1445
  });
1327
- if (!change) return globalState.UNCHANGED;
1446
+
1447
+ if (!change) {
1448
+ return globalState.UNCHANGED;
1449
+ }
1450
+
1328
1451
  newValue = change.newValue;
1329
1452
  } // apply modifier
1330
1453
 
@@ -1358,14 +1481,17 @@
1358
1481
  };
1359
1482
 
1360
1483
  _proto.observe_ = function observe_(listener, fireImmediately) {
1361
- if (fireImmediately) listener({
1362
- observableKind: "value",
1363
- debugObjectName: this.name_,
1364
- object: this,
1365
- type: UPDATE,
1366
- newValue: this.value_,
1367
- oldValue: undefined
1368
- });
1484
+ if (fireImmediately) {
1485
+ listener({
1486
+ observableKind: "value",
1487
+ debugObjectName: this.name_,
1488
+ object: this,
1489
+ type: UPDATE,
1490
+ newValue: this.value_,
1491
+ oldValue: undefined
1492
+ });
1493
+ }
1494
+
1369
1495
  return registerListener(this, listener);
1370
1496
  };
1371
1497
 
@@ -1460,7 +1586,11 @@
1460
1586
  this.keepAlive_ = void 0;
1461
1587
  this.onBOL = void 0;
1462
1588
  this.onBUOL = void 0;
1463
- if (!options.get) die(31);
1589
+
1590
+ if (!options.get) {
1591
+ die(31);
1592
+ }
1593
+
1464
1594
  this.derivation = options.get;
1465
1595
  this.name_ = options.name || ( "ComputedValue@" + getNextId() );
1466
1596
 
@@ -1502,7 +1632,9 @@
1502
1632
  ;
1503
1633
 
1504
1634
  _proto.get = function get() {
1505
- if (this.isComputing_) die(32, this.name_, this.derivation);
1635
+ if (this.isComputing_) {
1636
+ die(32, this.name_, this.derivation);
1637
+ }
1506
1638
 
1507
1639
  if (globalState.inBatch === 0 && // !globalState.trackingDerivatpion &&
1508
1640
  this.observers_.size === 0 && !this.keepAlive_) {
@@ -1518,20 +1650,34 @@
1518
1650
 
1519
1651
  if (shouldCompute(this)) {
1520
1652
  var prevTrackingContext = globalState.trackingContext;
1521
- if (this.keepAlive_ && !prevTrackingContext) globalState.trackingContext = this;
1522
- if (this.trackAndCompute()) propagateChangeConfirmed(this);
1653
+
1654
+ if (this.keepAlive_ && !prevTrackingContext) {
1655
+ globalState.trackingContext = this;
1656
+ }
1657
+
1658
+ if (this.trackAndCompute()) {
1659
+ propagateChangeConfirmed(this);
1660
+ }
1661
+
1523
1662
  globalState.trackingContext = prevTrackingContext;
1524
1663
  }
1525
1664
  }
1526
1665
 
1527
1666
  var result = this.value_;
1528
- if (isCaughtException(result)) throw result.cause;
1667
+
1668
+ if (isCaughtException(result)) {
1669
+ throw result.cause;
1670
+ }
1671
+
1529
1672
  return result;
1530
1673
  };
1531
1674
 
1532
1675
  _proto.set = function set(value) {
1533
1676
  if (this.setter_) {
1534
- if (this.isRunningSetter_) die(33, this.name_);
1677
+ if (this.isRunningSetter_) {
1678
+ die(33, this.name_);
1679
+ }
1680
+
1535
1681
  this.isRunningSetter_ = true;
1536
1682
 
1537
1683
  try {
@@ -1539,7 +1685,9 @@
1539
1685
  } finally {
1540
1686
  this.isRunningSetter_ = false;
1541
1687
  }
1542
- } else die(34, this.name_);
1688
+ } else {
1689
+ die(34, this.name_);
1690
+ }
1543
1691
  };
1544
1692
 
1545
1693
  _proto.trackAndCompute = function trackAndCompute() {
@@ -1768,7 +1916,9 @@
1768
1916
 
1769
1917
  var hasObservers = atom.observers_.size > 0; // Should not be possible to change observed state outside strict mode, except during initialization, see #563
1770
1918
 
1771
- 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_);
1919
+ if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "always")) {
1920
+ 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_);
1921
+ }
1772
1922
  }
1773
1923
  function checkIfStateReadsAreAllowed(observable) {
1774
1924
  if ( !globalState.allowStateReads && globalState.observableRequiresReaction) {
@@ -1813,7 +1963,10 @@
1813
1963
  }
1814
1964
 
1815
1965
  function warnAboutDerivationWithoutDependencies(derivation) {
1816
- if (derivation.observing_.length !== 0) return;
1966
+
1967
+ if (derivation.observing_.length !== 0) {
1968
+ return;
1969
+ }
1817
1970
 
1818
1971
  if (globalState.reactionRequiresObservable || derivation.requiresObservable_) {
1819
1972
  console.warn("[mobx] Derivation '" + derivation.name_ + "' is created/updated without reading any observable value.");
@@ -1842,7 +1995,11 @@
1842
1995
 
1843
1996
  if (dep.diffValue_ === 0) {
1844
1997
  dep.diffValue_ = 1;
1845
- if (i0 !== i) observing[i0] = dep;
1998
+
1999
+ if (i0 !== i) {
2000
+ observing[i0] = dep;
2001
+ }
2002
+
1846
2003
  i0++;
1847
2004
  } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
1848
2005
  // not hitting the condition
@@ -1934,7 +2091,10 @@
1934
2091
  */
1935
2092
 
1936
2093
  function changeDependenciesStateTo0(derivation) {
1937
- if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) return;
2094
+ if (derivation.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
2095
+ return;
2096
+ }
2097
+
1938
2098
  derivation.dependenciesState_ = IDerivationState_.UP_TO_DATE_;
1939
2099
  var obs = derivation.observing_;
1940
2100
  var i = obs.length;
@@ -1978,8 +2138,14 @@
1978
2138
  var isolateCalled = false;
1979
2139
  var globalState = /*#__PURE__*/function () {
1980
2140
  var global = /*#__PURE__*/getGlobal();
1981
- if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false;
1982
- if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) canMergeGlobalState = false;
2141
+
2142
+ if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) {
2143
+ canMergeGlobalState = false;
2144
+ }
2145
+
2146
+ if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) {
2147
+ canMergeGlobalState = false;
2148
+ }
1983
2149
 
1984
2150
  if (!canMergeGlobalState) {
1985
2151
  // Because this is a IIFE we need to let isolateCalled a chance to change
@@ -1992,7 +2158,11 @@
1992
2158
  return new MobXGlobals();
1993
2159
  } else if (global.__mobxGlobals) {
1994
2160
  global.__mobxInstanceCount += 1;
1995
- if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible
2161
+
2162
+ if (!global.__mobxGlobals.UNCHANGED) {
2163
+ global.__mobxGlobals.UNCHANGED = {};
2164
+ } // make merge backward compatible
2165
+
1996
2166
 
1997
2167
  return global.__mobxGlobals;
1998
2168
  } else {
@@ -2001,12 +2171,19 @@
2001
2171
  }
2002
2172
  }();
2003
2173
  function isolateGlobalState() {
2004
- if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) die(36);
2174
+ if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) {
2175
+ die(36);
2176
+ }
2177
+
2005
2178
  isolateCalled = true;
2006
2179
 
2007
2180
  if (canMergeGlobalState) {
2008
2181
  var global = getGlobal();
2009
- if (--global.__mobxInstanceCount === 0) global.__mobxGlobals = undefined;
2182
+
2183
+ if (--global.__mobxInstanceCount === 0) {
2184
+ global.__mobxGlobals = undefined;
2185
+ }
2186
+
2010
2187
  globalState = new MobXGlobals();
2011
2188
  }
2012
2189
  }
@@ -2022,7 +2199,9 @@
2022
2199
  var defaultGlobals = new MobXGlobals();
2023
2200
 
2024
2201
  for (var key in defaultGlobals) {
2025
- if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key];
2202
+ if (persistentKeys.indexOf(key) === -1) {
2203
+ globalState[key] = defaultGlobals[key];
2204
+ }
2026
2205
  }
2027
2206
 
2028
2207
  globalState.allowStateChanges = !globalState.enforceActions;
@@ -2056,8 +2235,12 @@
2056
2235
  // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node");
2057
2236
  // invariantObservers(observable);
2058
2237
  observable.observers_.add(node);
2059
- if (observable.lowestObserverState_ > node.dependenciesState_) observable.lowestObserverState_ = node.dependenciesState_; // invariantObservers(observable);
2238
+
2239
+ if (observable.lowestObserverState_ > node.dependenciesState_) {
2240
+ observable.lowestObserverState_ = node.dependenciesState_;
2241
+ } // invariantObservers(observable);
2060
2242
  // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node");
2243
+
2061
2244
  }
2062
2245
  function removeObserver(observable, node) {
2063
2246
  // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch");
@@ -2168,7 +2351,10 @@
2168
2351
 
2169
2352
  function propagateChanged(observable) {
2170
2353
  // invariantLOS(observable, "changed start");
2171
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2354
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2355
+ return;
2356
+ }
2357
+
2172
2358
  observable.lowestObserverState_ = IDerivationState_.STALE_; // Ideally we use for..of here, but the downcompiled version is really slow...
2173
2359
 
2174
2360
  observable.observers_.forEach(function (d) {
@@ -2186,7 +2372,10 @@
2186
2372
 
2187
2373
  function propagateChangeConfirmed(observable) {
2188
2374
  // invariantLOS(observable, "confirmed start");
2189
- if (observable.lowestObserverState_ === IDerivationState_.STALE_) return;
2375
+ if (observable.lowestObserverState_ === IDerivationState_.STALE_) {
2376
+ return;
2377
+ }
2378
+
2190
2379
  observable.lowestObserverState_ = IDerivationState_.STALE_;
2191
2380
  observable.observers_.forEach(function (d) {
2192
2381
  if (d.dependenciesState_ === IDerivationState_.POSSIBLY_STALE_) {
@@ -2204,7 +2393,10 @@
2204
2393
 
2205
2394
  function propagateMaybeChanged(observable) {
2206
2395
  // invariantLOS(observable, "maybe start");
2207
- if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) return;
2396
+ if (observable.lowestObserverState_ !== IDerivationState_.UP_TO_DATE_) {
2397
+ return;
2398
+ }
2399
+
2208
2400
  observable.lowestObserverState_ = IDerivationState_.POSSIBLY_STALE_;
2209
2401
  observable.observers_.forEach(function (d) {
2210
2402
  if (d.dependenciesState_ === IDerivationState_.UP_TO_DATE_) {
@@ -2232,9 +2424,12 @@
2232
2424
  }
2233
2425
 
2234
2426
  lines.push("" + "\t".repeat(depth - 1) + tree.name);
2235
- if (tree.dependencies) tree.dependencies.forEach(function (child) {
2236
- return printDepTree(child, lines, depth + 1);
2237
- });
2427
+
2428
+ if (tree.dependencies) {
2429
+ tree.dependencies.forEach(function (child) {
2430
+ return printDepTree(child, lines, depth + 1);
2431
+ });
2432
+ }
2238
2433
  }
2239
2434
 
2240
2435
  var Reaction = /*#__PURE__*/function () {
@@ -2352,7 +2547,9 @@
2352
2547
  clearObserving(this);
2353
2548
  }
2354
2549
 
2355
- if (isCaughtException(result)) this.reportExceptionInDerivation_(result.cause);
2550
+ if (isCaughtException(result)) {
2551
+ this.reportExceptionInDerivation_(result.cause);
2552
+ }
2356
2553
 
2357
2554
  if ( notify) {
2358
2555
  spyReportEnd({
@@ -2371,13 +2568,18 @@
2371
2568
  return;
2372
2569
  }
2373
2570
 
2374
- if (globalState.disableErrorBoundaries) throw error;
2571
+ if (globalState.disableErrorBoundaries) {
2572
+ throw error;
2573
+ }
2574
+
2375
2575
  var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'" ;
2376
2576
 
2377
2577
  if (!globalState.suppressReactionErrors) {
2378
2578
  console.error(message, error);
2379
2579
  /** If debugging brought you here, please, read the above message :-). Tnx! */
2380
- } else console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)"); // prettier-ignore
2580
+ } else {
2581
+ console.warn("[mobx] (error in reaction '" + this.name_ + "' suppressed, fix error of causing action below)");
2582
+ } // prettier-ignore
2381
2583
 
2382
2584
 
2383
2585
  if ( isSpyEnabled()) {
@@ -2431,7 +2633,10 @@
2431
2633
  globalState.globalReactionErrorHandlers.push(handler);
2432
2634
  return function () {
2433
2635
  var idx = globalState.globalReactionErrorHandlers.indexOf(handler);
2434
- if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1);
2636
+
2637
+ if (idx >= 0) {
2638
+ globalState.globalReactionErrorHandlers.splice(idx, 1);
2639
+ }
2435
2640
  };
2436
2641
  }
2437
2642
  /**
@@ -2448,7 +2653,10 @@
2448
2653
 
2449
2654
  function runReactions() {
2450
2655
  // Trampolining, if runReactions are already running, new reactions will be picked up
2451
- if (globalState.inBatch > 0 || globalState.isRunningReactions) return;
2656
+ if (globalState.inBatch > 0 || globalState.isRunningReactions) {
2657
+ return;
2658
+ }
2659
+
2452
2660
  reactionScheduler(runReactionsHelper);
2453
2661
  }
2454
2662
 
@@ -2491,7 +2699,11 @@
2491
2699
  }
2492
2700
  function spyReport(event) {
2493
2701
 
2494
- if (!globalState.spyListeners.length) return;
2702
+
2703
+ if (!globalState.spyListeners.length) {
2704
+ return;
2705
+ }
2706
+
2495
2707
  var listeners = globalState.spyListeners;
2496
2708
 
2497
2709
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -2511,10 +2723,15 @@
2511
2723
  spyReportEnd: true
2512
2724
  };
2513
2725
  function spyReportEnd(change) {
2514
- if (change) spyReport(_extends({}, change, {
2515
- type: "report-end",
2516
- spyReportEnd: true
2517
- }));else spyReport(END_EVENT);
2726
+
2727
+ if (change) {
2728
+ spyReport(_extends({}, change, {
2729
+ type: "report-end",
2730
+ spyReportEnd: true
2731
+ }));
2732
+ } else {
2733
+ spyReport(END_EVENT);
2734
+ }
2518
2735
  }
2519
2736
  function spy(listener) {
2520
2737
  {
@@ -2547,9 +2764,15 @@
2547
2764
  function createActionFactory(autoAction) {
2548
2765
  var res = function action(arg1, arg2) {
2549
2766
  // action(fn() {})
2550
- if (isFunction(arg1)) return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction); // action("name", fn() {})
2767
+ if (isFunction(arg1)) {
2768
+ return createAction(arg1.name || DEFAULT_ACTION_NAME, arg1, autoAction);
2769
+ } // action("name", fn() {})
2770
+
2771
+
2772
+ if (isFunction(arg2)) {
2773
+ return createAction(arg1, arg2, autoAction);
2774
+ } // @action
2551
2775
 
2552
- if (isFunction(arg2)) return createAction(arg1, arg2, autoAction); // @action
2553
2776
 
2554
2777
  if (isStringish(arg2)) {
2555
2778
  return storeAnnotation(arg1, arg2, autoAction ? autoActionAnnotation : actionAnnotation);
@@ -2563,7 +2786,9 @@
2563
2786
  }));
2564
2787
  }
2565
2788
 
2566
- die("Invalid arguments for `action`");
2789
+ {
2790
+ die("Invalid arguments for `action`");
2791
+ }
2567
2792
  };
2568
2793
 
2569
2794
  return res;
@@ -2597,8 +2822,13 @@
2597
2822
  }
2598
2823
 
2599
2824
  {
2600
- if (!isFunction(view)) die("Autorun expects a function as first argument");
2601
- if (isAction(view)) die("Autorun does not accept actions since actions are untrackable");
2825
+ if (!isFunction(view)) {
2826
+ die("Autorun expects a function as first argument");
2827
+ }
2828
+
2829
+ if (isAction(view)) {
2830
+ die("Autorun does not accept actions since actions are untrackable");
2831
+ }
2602
2832
  }
2603
2833
 
2604
2834
  var name = (_opts$name = (_opts = opts) == null ? void 0 : _opts.name) != null ? _opts$name : view.name || "Autorun@" + getNextId() ;
@@ -2619,7 +2849,10 @@
2619
2849
  isScheduled = true;
2620
2850
  scheduler(function () {
2621
2851
  isScheduled = false;
2622
- if (!reaction.isDisposed_) reaction.track(reactionRunner);
2852
+
2853
+ if (!reaction.isDisposed_) {
2854
+ reaction.track(reactionRunner);
2855
+ }
2623
2856
  });
2624
2857
  }
2625
2858
  }, opts.onError, opts.requiresObservable);
@@ -2651,8 +2884,13 @@
2651
2884
  }
2652
2885
 
2653
2886
  {
2654
- if (!isFunction(expression) || !isFunction(effect)) die("First and second argument to reaction should be functions");
2655
- if (!isPlainObject(opts)) die("Third argument of reactions should be an object");
2887
+ if (!isFunction(expression) || !isFunction(effect)) {
2888
+ die("First and second argument to reaction should be functions");
2889
+ }
2890
+
2891
+ if (!isPlainObject(opts)) {
2892
+ die("Third argument of reactions should be an object");
2893
+ }
2656
2894
  }
2657
2895
 
2658
2896
  var name = (_opts$name2 = opts.name) != null ? _opts$name2 : "Reaction@" + getNextId() ;
@@ -2675,7 +2913,11 @@
2675
2913
 
2676
2914
  function reactionRunner() {
2677
2915
  isScheduled = false;
2678
- if (r.isDisposed_) return;
2916
+
2917
+ if (r.isDisposed_) {
2918
+ return;
2919
+ }
2920
+
2679
2921
  var changed = false;
2680
2922
  r.track(function () {
2681
2923
  var nextValue = allowStateChanges(false, function () {
@@ -2685,7 +2927,13 @@
2685
2927
  oldValue = value;
2686
2928
  value = nextValue;
2687
2929
  });
2688
- if (firstTime && opts.fireImmediately) effectAction(value, oldValue, r);else if (!firstTime && changed) effectAction(value, oldValue, r);
2930
+
2931
+ if (firstTime && opts.fireImmediately) {
2932
+ effectAction(value, oldValue, r);
2933
+ } else if (!firstTime && changed) {
2934
+ effectAction(value, oldValue, r);
2935
+ }
2936
+
2689
2937
  firstTime = false;
2690
2938
  }
2691
2939
 
@@ -2752,7 +3000,9 @@
2752
3000
  globalState.useProxies = useProxies === ALWAYS ? true : useProxies === NEVER ? false : typeof Proxy !== "undefined";
2753
3001
  }
2754
3002
 
2755
- if (useProxies === "ifavailable") globalState.verifyProxies = true;
3003
+ if (useProxies === "ifavailable") {
3004
+ globalState.verifyProxies = true;
3005
+ }
2756
3006
 
2757
3007
  if (enforceActions !== undefined) {
2758
3008
  var ea = enforceActions === ALWAYS ? ALWAYS : enforceActions === OBSERVED;
@@ -2760,7 +3010,9 @@
2760
3010
  globalState.allowStateChanges = ea === true || ea === ALWAYS ? false : true;
2761
3011
  }
2762
3012
  ["computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "disableErrorBoundaries", "safeDescriptors"].forEach(function (key) {
2763
- if (key in options) globalState[key] = !!options[key];
3013
+ if (key in options) {
3014
+ globalState[key] = !!options[key];
3015
+ }
2764
3016
  });
2765
3017
  globalState.allowStateReads = !globalState.observableRequiresReaction;
2766
3018
 
@@ -2775,11 +3027,25 @@
2775
3027
 
2776
3028
  function extendObservable(target, properties, annotations, options) {
2777
3029
  {
2778
- if (arguments.length > 4) die("'extendObservable' expected 2-4 arguments");
2779
- if (typeof target !== "object") die("'extendObservable' expects an object as first argument");
2780
- if (isObservableMap(target)) die("'extendObservable' should not be used on maps, use map.merge instead");
2781
- if (!isPlainObject(properties)) die("'extendObservable' only accepts plain objects as second argument");
2782
- if (isObservable(properties) || isObservable(annotations)) die("Extending an object with another observable (object) is not supported");
3030
+ if (arguments.length > 4) {
3031
+ die("'extendObservable' expected 2-4 arguments");
3032
+ }
3033
+
3034
+ if (typeof target !== "object") {
3035
+ die("'extendObservable' expects an object as first argument");
3036
+ }
3037
+
3038
+ if (isObservableMap(target)) {
3039
+ die("'extendObservable' should not be used on maps, use map.merge instead");
3040
+ }
3041
+
3042
+ if (!isPlainObject(properties)) {
3043
+ die("'extendObservable' only accepts plain objects as second argument");
3044
+ }
3045
+
3046
+ if (isObservable(properties) || isObservable(annotations)) {
3047
+ die("Extending an object with another observable (object) is not supported");
3048
+ }
2783
3049
  } // Pull descriptors first, so we don't have to deal with props added by administration ($mobx)
2784
3050
 
2785
3051
 
@@ -2807,7 +3073,11 @@
2807
3073
  var result = {
2808
3074
  name: node.name_
2809
3075
  };
2810
- if (node.observing_ && node.observing_.length > 0) result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3076
+
3077
+ if (node.observing_ && node.observing_.length > 0) {
3078
+ result.dependencies = unique(node.observing_).map(nodeToDependencyTree);
3079
+ }
3080
+
2811
3081
  return result;
2812
3082
  }
2813
3083
 
@@ -2819,7 +3089,11 @@
2819
3089
  var result = {
2820
3090
  name: node.name_
2821
3091
  };
2822
- if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3092
+
3093
+ if (hasObservers(node)) {
3094
+ result.observers = Array.from(getObservers(node)).map(nodeToObserverTree);
3095
+ }
3096
+
2823
3097
  return result;
2824
3098
  }
2825
3099
 
@@ -2846,7 +3120,10 @@
2846
3120
  } // flow(fn)
2847
3121
 
2848
3122
 
2849
- if ( arguments.length !== 1) die("Flow expects single argument with generator function");
3123
+ if ( arguments.length !== 1) {
3124
+ die("Flow expects single argument with generator function");
3125
+ }
3126
+
2850
3127
  var generator = arg1;
2851
3128
  var name = generator.name || "<unnamed flow>"; // Implementation based on https://github.com/tj/co/blob/master/index.js
2852
3129
 
@@ -2894,7 +3171,10 @@
2894
3171
  return;
2895
3172
  }
2896
3173
 
2897
- if (ret.done) return resolve(ret.value);
3174
+ if (ret.done) {
3175
+ return resolve(ret.value);
3176
+ }
3177
+
2898
3178
  pendingPromise = Promise.resolve(ret.value);
2899
3179
  return pendingPromise.then(onFulfilled, onRejected);
2900
3180
  }
@@ -2903,7 +3183,10 @@
2903
3183
  });
2904
3184
  promise.cancel = action(name + " - runid: " + runId + " - cancel", function () {
2905
3185
  try {
2906
- if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff..
3186
+ if (pendingPromise) {
3187
+ cancelPromise(pendingPromise);
3188
+ } // Finally block can return (or yield) stuff..
3189
+
2907
3190
 
2908
3191
  var _res = gen["return"](undefined); // eat anything that promise would do, it's cancelled!
2909
3192
 
@@ -2927,7 +3210,9 @@
2927
3210
  flow.bound = /*#__PURE__*/createDecoratorAnnotation(flowBoundAnnotation);
2928
3211
 
2929
3212
  function cancelPromise(promise) {
2930
- if (isFunction(promise.cancel)) promise.cancel();
3213
+ if (isFunction(promise.cancel)) {
3214
+ promise.cancel();
3215
+ }
2931
3216
  }
2932
3217
 
2933
3218
  function flowResult(result) {
@@ -2943,13 +3228,19 @@
2943
3228
  if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) {
2944
3229
  target = getAdministration(thing);
2945
3230
  } else if (isObservableObject(thing)) {
2946
- if ( !isStringish(propOrHandler)) return die("InterceptReads can only be used with a specific property, not with an object in general");
3231
+ if ( !isStringish(propOrHandler)) {
3232
+ return die("InterceptReads can only be used with a specific property, not with an object in general");
3233
+ }
3234
+
2947
3235
  target = getAdministration(thing, propOrHandler);
2948
3236
  } else {
2949
3237
  return die("Expected observable map, object or array as first array");
2950
3238
  }
2951
3239
 
2952
- if ( target.dehancer !== undefined) return die("An intercept reader was already established");
3240
+ if ( target.dehancer !== undefined) {
3241
+ return die("An intercept reader was already established");
3242
+ }
3243
+
2953
3244
  target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler;
2954
3245
  return function () {
2955
3246
  target.dehancer = undefined;
@@ -2957,7 +3248,11 @@
2957
3248
  }
2958
3249
 
2959
3250
  function intercept(thing, propOrHandler, handler) {
2960
- if (isFunction(handler)) return interceptProperty(thing, propOrHandler, handler);else return interceptInterceptable(thing, propOrHandler);
3251
+ if (isFunction(handler)) {
3252
+ return interceptProperty(thing, propOrHandler, handler);
3253
+ } else {
3254
+ return interceptInterceptable(thing, propOrHandler);
3255
+ }
2961
3256
  }
2962
3257
 
2963
3258
  function interceptInterceptable(thing, handler) {
@@ -2973,25 +3268,41 @@
2973
3268
  return isComputedValue(value);
2974
3269
  }
2975
3270
 
2976
- if (isObservableObject(value) === false) return false;
2977
- if (!value[$mobx].values_.has(property)) return false;
3271
+ if (isObservableObject(value) === false) {
3272
+ return false;
3273
+ }
3274
+
3275
+ if (!value[$mobx].values_.has(property)) {
3276
+ return false;
3277
+ }
3278
+
2978
3279
  var atom = getAtom(value, property);
2979
3280
  return isComputedValue(atom);
2980
3281
  }
2981
3282
  function isComputed(value) {
2982
- if ( arguments.length > 1) return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3283
+ if ( arguments.length > 1) {
3284
+ return die("isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property");
3285
+ }
3286
+
2983
3287
  return _isComputed(value);
2984
3288
  }
2985
3289
  function isComputedProp(value, propName) {
2986
- if ( !isStringish(propName)) return die("isComputed expected a property name as second argument");
3290
+ if ( !isStringish(propName)) {
3291
+ return die("isComputed expected a property name as second argument");
3292
+ }
3293
+
2987
3294
  return _isComputed(value, propName);
2988
3295
  }
2989
3296
 
2990
3297
  function _isObservable(value, property) {
2991
- if (!value) return false;
3298
+ if (!value) {
3299
+ return false;
3300
+ }
2992
3301
 
2993
3302
  if (property !== undefined) {
2994
- if ( (isObservableMap(value) || isObservableArray(value))) return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3303
+ if ( (isObservableMap(value) || isObservableArray(value))) {
3304
+ return die("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.");
3305
+ }
2995
3306
 
2996
3307
  if (isObservableObject(value)) {
2997
3308
  return value[$mobx].values_.has(property);
@@ -3005,11 +3316,17 @@
3005
3316
  }
3006
3317
 
3007
3318
  function isObservable(value) {
3008
- if ( arguments.length !== 1) die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3319
+ if ( arguments.length !== 1) {
3320
+ die("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property");
3321
+ }
3322
+
3009
3323
  return _isObservable(value);
3010
3324
  }
3011
3325
  function isObservableProp(value, propName) {
3012
- if ( !isStringish(propName)) return die("expected a property name as second argument");
3326
+ if ( !isStringish(propName)) {
3327
+ return die("expected a property name as second argument");
3328
+ }
3329
+
3013
3330
  return _isObservable(value, propName);
3014
3331
  }
3015
3332
 
@@ -3101,13 +3418,25 @@
3101
3418
  } else if (isObservableSet(obj)) {
3102
3419
  obj.add(key);
3103
3420
  } else if (isObservableArray(obj)) {
3104
- if (typeof key !== "number") key = parseInt(key, 10);
3105
- if (key < 0) die("Invalid index: '" + key + "'");
3106
- startBatch();
3107
- if (key >= obj.length) obj.length = key + 1;
3108
- obj[key] = value;
3109
- endBatch();
3110
- } else die(8);
3421
+ if (typeof key !== "number") {
3422
+ key = parseInt(key, 10);
3423
+ }
3424
+
3425
+ if (key < 0) {
3426
+ die("Invalid index: '" + key + "'");
3427
+ }
3428
+
3429
+ startBatch();
3430
+
3431
+ if (key >= obj.length) {
3432
+ obj.length = key + 1;
3433
+ }
3434
+
3435
+ obj[key] = value;
3436
+ endBatch();
3437
+ } else {
3438
+ die(8);
3439
+ }
3111
3440
  }
3112
3441
  function remove(obj, key) {
3113
3442
  if (isObservableObject(obj)) {
@@ -3117,7 +3446,10 @@
3117
3446
  } else if (isObservableSet(obj)) {
3118
3447
  obj["delete"](key);
3119
3448
  } else if (isObservableArray(obj)) {
3120
- if (typeof key !== "number") key = parseInt(key, 10);
3449
+ if (typeof key !== "number") {
3450
+ key = parseInt(key, 10);
3451
+ }
3452
+
3121
3453
  obj.splice(key, 1);
3122
3454
  } else {
3123
3455
  die(9);
@@ -3137,7 +3469,9 @@
3137
3469
  die(10);
3138
3470
  }
3139
3471
  function get(obj, key) {
3140
- if (!has(obj, key)) return undefined;
3472
+ if (!has(obj, key)) {
3473
+ return undefined;
3474
+ }
3141
3475
 
3142
3476
  if (isObservableObject(obj)) {
3143
3477
  return obj[$mobx].get_(key);
@@ -3165,7 +3499,11 @@
3165
3499
  }
3166
3500
 
3167
3501
  function observe(thing, propOrCb, cbOrFire, fireImmediately) {
3168
- if (isFunction(cbOrFire)) return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);else return observeObservable(thing, propOrCb, cbOrFire);
3502
+ if (isFunction(cbOrFire)) {
3503
+ return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately);
3504
+ } else {
3505
+ return observeObservable(thing, propOrCb, cbOrFire);
3506
+ }
3169
3507
  }
3170
3508
 
3171
3509
  function observeObservable(thing, listener, fireImmediately) {
@@ -3182,8 +3520,13 @@
3182
3520
  }
3183
3521
 
3184
3522
  function toJSHelper(source, __alreadySeen) {
3185
- if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) return source;
3186
- if (isObservableValue(source) || isComputedValue(source)) return toJSHelper(source.get(), __alreadySeen);
3523
+ if (source == null || typeof source !== "object" || source instanceof Date || !isObservable(source)) {
3524
+ return source;
3525
+ }
3526
+
3527
+ if (isObservableValue(source) || isComputedValue(source)) {
3528
+ return toJSHelper(source.get(), __alreadySeen);
3529
+ }
3187
3530
 
3188
3531
  if (__alreadySeen.has(source)) {
3189
3532
  return __alreadySeen.get(source);
@@ -3226,23 +3569,33 @@
3226
3569
  }
3227
3570
  }
3228
3571
  /**
3229
- * Basically, a deep clone, so that no reactive property will exist anymore.
3572
+ * Recursively converts an observable to it's non-observable native counterpart.
3573
+ * It does NOT recurse into non-observables, these are left as they are, even if they contain observables.
3574
+ * Computed and other non-enumerable properties are completely ignored.
3575
+ * Complex scenarios require custom solution, eg implementing `toJSON` or using `serializr` lib.
3230
3576
  */
3231
3577
 
3232
3578
 
3233
3579
  function toJS(source, options) {
3234
- if ( options) die("toJS no longer supports options");
3580
+ if ( options) {
3581
+ die("toJS no longer supports options");
3582
+ }
3583
+
3235
3584
  return toJSHelper(source, new Map());
3236
3585
  }
3237
3586
 
3238
3587
  function trace() {
3588
+
3239
3589
  var enterBreakPoint = false;
3240
3590
 
3241
3591
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3242
3592
  args[_key] = arguments[_key];
3243
3593
  }
3244
3594
 
3245
- if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop();
3595
+ if (typeof args[args.length - 1] === "boolean") {
3596
+ enterBreakPoint = args.pop();
3597
+ }
3598
+
3246
3599
  var derivation = getAtomFromArgs(args);
3247
3600
 
3248
3601
  if (!derivation) {
@@ -3292,7 +3645,10 @@
3292
3645
  }
3293
3646
 
3294
3647
  function when(predicate, arg1, arg2) {
3295
- if (arguments.length === 1 || arg1 && typeof arg1 === "object") return whenPromise(predicate, arg1);
3648
+ if (arguments.length === 1 || arg1 && typeof arg1 === "object") {
3649
+ return whenPromise(predicate, arg1);
3650
+ }
3651
+
3296
3652
  return _when(predicate, arg1, arg2 || {});
3297
3653
  }
3298
3654
 
@@ -3304,7 +3660,12 @@
3304
3660
  timeoutHandle = setTimeout(function () {
3305
3661
  if (!disposer[$mobx].isDisposed_) {
3306
3662
  disposer();
3307
- if (opts.onError) opts.onError(error);else throw error;
3663
+
3664
+ if (opts.onError) {
3665
+ opts.onError(error);
3666
+ } else {
3667
+ throw error;
3668
+ }
3308
3669
  }
3309
3670
  }, opts.timeout);
3310
3671
  }
@@ -3318,7 +3679,11 @@
3318
3679
 
3319
3680
  if (cond) {
3320
3681
  r.dispose();
3321
- if (timeoutHandle) clearTimeout(timeoutHandle);
3682
+
3683
+ if (timeoutHandle) {
3684
+ clearTimeout(timeoutHandle);
3685
+ }
3686
+
3322
3687
  effectAction();
3323
3688
  }
3324
3689
  }, opts);
@@ -3326,7 +3691,10 @@
3326
3691
  }
3327
3692
 
3328
3693
  function whenPromise(predicate, opts) {
3329
- if ( opts && opts.onError) return die("the options 'onError' and 'promise' cannot be combined");
3694
+ if ( opts && opts.onError) {
3695
+ return die("the options 'onError' and 'promise' cannot be combined");
3696
+ }
3697
+
3330
3698
  var cancel;
3331
3699
  var res = new Promise(function (resolve, reject) {
3332
3700
  var disposer = _when(predicate, resolve, _extends({}, opts, {
@@ -3350,7 +3718,10 @@
3350
3718
 
3351
3719
  var objectProxyTraps = {
3352
3720
  has: function has(target, name) {
3353
- if ( globalState.trackingDerivation) warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3721
+ if ( globalState.trackingDerivation) {
3722
+ warnAboutProxyRequirement("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.");
3723
+ }
3724
+
3354
3725
  return getAdm(target).has_(name);
3355
3726
  },
3356
3727
  get: function get(target, name) {
@@ -3359,7 +3730,9 @@
3359
3730
  set: function set(target, name, value) {
3360
3731
  var _getAdm$set_;
3361
3732
 
3362
- if (!isStringish(name)) return false;
3733
+ if (!isStringish(name)) {
3734
+ return false;
3735
+ }
3363
3736
 
3364
3737
  if ( !getAdm(target).values_.has(name)) {
3365
3738
  warnAboutProxyRequirement("add a new observable property through direct assignment. Use 'set' from 'mobx' instead.");
@@ -3375,7 +3748,10 @@
3375
3748
  warnAboutProxyRequirement("delete properties from an observable object. Use 'remove' from 'mobx' instead.");
3376
3749
  }
3377
3750
 
3378
- if (!isStringish(name)) return false; // null (intercepted) -> true (success)
3751
+ if (!isStringish(name)) {
3752
+ return false;
3753
+ } // null (intercepted) -> true (success)
3754
+
3379
3755
 
3380
3756
  return (_getAdm$delete_ = getAdm(target).delete_(name, true)) != null ? _getAdm$delete_ : true;
3381
3757
  },
@@ -3390,7 +3766,10 @@
3390
3766
  return (_getAdm$definePropert = getAdm(target).defineProperty_(name, descriptor)) != null ? _getAdm$definePropert : true;
3391
3767
  },
3392
3768
  ownKeys: function ownKeys(target) {
3393
- if ( globalState.trackingDerivation) warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3769
+ if ( globalState.trackingDerivation) {
3770
+ warnAboutProxyRequirement("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.");
3771
+ }
3772
+
3394
3773
  return getAdm(target).ownKeys_();
3395
3774
  },
3396
3775
  preventExtensions: function preventExtensions(target) {
@@ -3413,7 +3792,10 @@
3413
3792
  interceptors.push(handler);
3414
3793
  return once(function () {
3415
3794
  var idx = interceptors.indexOf(handler);
3416
- if (idx !== -1) interceptors.splice(idx, 1);
3795
+
3796
+ if (idx !== -1) {
3797
+ interceptors.splice(idx, 1);
3798
+ }
3417
3799
  });
3418
3800
  }
3419
3801
  function interceptChange(interceptable, change) {
@@ -3425,8 +3807,14 @@
3425
3807
 
3426
3808
  for (var i = 0, l = interceptors.length; i < l; i++) {
3427
3809
  change = interceptors[i](change);
3428
- if (change && !change.type) die(14);
3429
- if (!change) break;
3810
+
3811
+ if (change && !change.type) {
3812
+ die(14);
3813
+ }
3814
+
3815
+ if (!change) {
3816
+ break;
3817
+ }
3430
3818
  }
3431
3819
 
3432
3820
  return change;
@@ -3443,13 +3831,20 @@
3443
3831
  listeners.push(handler);
3444
3832
  return once(function () {
3445
3833
  var idx = listeners.indexOf(handler);
3446
- if (idx !== -1) listeners.splice(idx, 1);
3834
+
3835
+ if (idx !== -1) {
3836
+ listeners.splice(idx, 1);
3837
+ }
3447
3838
  });
3448
3839
  }
3449
3840
  function notifyListeners(listenable, change) {
3450
3841
  var prevU = untrackedStart();
3451
3842
  var listeners = listenable.changeListeners_;
3452
- if (!listeners) return;
3843
+
3844
+ if (!listeners) {
3845
+ return;
3846
+ }
3847
+
3453
3848
  listeners = listeners.slice();
3454
3849
 
3455
3850
  for (var i = 0, l = listeners.length; i < l; i++) {
@@ -3486,8 +3881,13 @@
3486
3881
  var keysSymbol = /*#__PURE__*/Symbol("mobx-keys");
3487
3882
  function makeAutoObservable(target, overrides, options) {
3488
3883
  {
3489
- if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3490
- if (isObservableObject(target)) die("makeAutoObservable can only be used on objects not already made observable");
3884
+ if (!isPlainObject(target) && !isPlainObject(Object.getPrototypeOf(target))) {
3885
+ die("'makeAutoObservable' can only be used for classes that don't have a superclass");
3886
+ }
3887
+
3888
+ if (isObservableObject(target)) {
3889
+ die("makeAutoObservable can only be used on objects not already made observable");
3890
+ }
3491
3891
  } // Optimization: avoid visiting protos
3492
3892
  // Assumes that annotation.make_/.extend_ works the same for plain objects
3493
3893
 
@@ -3528,8 +3928,14 @@
3528
3928
  var arrayTraps = {
3529
3929
  get: function get(target, name) {
3530
3930
  var adm = target[$mobx];
3531
- if (name === $mobx) return adm;
3532
- if (name === "length") return adm.getArrayLength_();
3931
+
3932
+ if (name === $mobx) {
3933
+ return adm;
3934
+ }
3935
+
3936
+ if (name === "length") {
3937
+ return adm.getArrayLength_();
3938
+ }
3533
3939
 
3534
3940
  if (typeof name === "string" && !isNaN(name)) {
3535
3941
  return adm.get_(parseInt(name));
@@ -3590,12 +3996,18 @@
3590
3996
  var _proto = ObservableArrayAdministration.prototype;
3591
3997
 
3592
3998
  _proto.dehanceValue_ = function dehanceValue_(value) {
3593
- if (this.dehancer !== undefined) return this.dehancer(value);
3999
+ if (this.dehancer !== undefined) {
4000
+ return this.dehancer(value);
4001
+ }
4002
+
3594
4003
  return value;
3595
4004
  };
3596
4005
 
3597
4006
  _proto.dehanceValues_ = function dehanceValues_(values) {
3598
- if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer);
4007
+ if (this.dehancer !== undefined && values.length > 0) {
4008
+ return values.map(this.dehancer);
4009
+ }
4010
+
3599
4011
  return values;
3600
4012
  };
3601
4013
 
@@ -3631,9 +4043,15 @@
3631
4043
  };
3632
4044
 
3633
4045
  _proto.setArrayLength_ = function setArrayLength_(newLength) {
3634
- if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) die("Out of range: " + newLength);
4046
+ if (typeof newLength !== "number" || isNaN(newLength) || newLength < 0) {
4047
+ die("Out of range: " + newLength);
4048
+ }
4049
+
3635
4050
  var currentLength = this.values_.length;
3636
- if (newLength === currentLength) return;else if (newLength > currentLength) {
4051
+
4052
+ if (newLength === currentLength) {
4053
+ return;
4054
+ } else if (newLength > currentLength) {
3637
4055
  var newItems = new Array(newLength - currentLength);
3638
4056
 
3639
4057
  for (var i = 0; i < newLength - currentLength; i++) {
@@ -3642,13 +4060,21 @@
3642
4060
 
3643
4061
 
3644
4062
  this.spliceWithArray_(currentLength, 0, newItems);
3645
- } else this.spliceWithArray_(newLength, currentLength - newLength);
4063
+ } else {
4064
+ this.spliceWithArray_(newLength, currentLength - newLength);
4065
+ }
3646
4066
  };
3647
4067
 
3648
4068
  _proto.updateArrayLength_ = function updateArrayLength_(oldLength, delta) {
3649
- if (oldLength !== this.lastKnownLength_) die(16);
4069
+ if (oldLength !== this.lastKnownLength_) {
4070
+ die(16);
4071
+ }
4072
+
3650
4073
  this.lastKnownLength_ += delta;
3651
- if (this.legacyMode_ && delta > 0) reserveArrayBuffer(oldLength + delta + 1);
4074
+
4075
+ if (this.legacyMode_ && delta > 0) {
4076
+ reserveArrayBuffer(oldLength + delta + 1);
4077
+ }
3652
4078
  };
3653
4079
 
3654
4080
  _proto.spliceWithArray_ = function spliceWithArray_(index, deleteCount, newItems) {
@@ -3656,9 +4082,26 @@
3656
4082
 
3657
4083
  checkIfStateModificationsAreAllowed(this.atom_);
3658
4084
  var length = this.values_.length;
3659
- if (index === undefined) index = 0;else if (index > length) index = length;else if (index < 0) index = Math.max(0, length + index);
3660
- 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));
3661
- if (newItems === undefined) newItems = EMPTY_ARRAY;
4085
+
4086
+ if (index === undefined) {
4087
+ index = 0;
4088
+ } else if (index > length) {
4089
+ index = length;
4090
+ } else if (index < 0) {
4091
+ index = Math.max(0, length + index);
4092
+ }
4093
+
4094
+ if (arguments.length === 1) {
4095
+ deleteCount = length - index;
4096
+ } else if (deleteCount === undefined || deleteCount === null) {
4097
+ deleteCount = 0;
4098
+ } else {
4099
+ deleteCount = Math.max(0, Math.min(deleteCount, length - index));
4100
+ }
4101
+
4102
+ if (newItems === undefined) {
4103
+ newItems = EMPTY_ARRAY;
4104
+ }
3662
4105
 
3663
4106
  if (hasInterceptors(this)) {
3664
4107
  var change = interceptChange(this, {
@@ -3668,7 +4111,11 @@
3668
4111
  removedCount: deleteCount,
3669
4112
  added: newItems
3670
4113
  });
3671
- if (!change) return EMPTY_ARRAY;
4114
+
4115
+ if (!change) {
4116
+ return EMPTY_ARRAY;
4117
+ }
4118
+
3672
4119
  deleteCount = change.removedCount;
3673
4120
  newItems = change.added;
3674
4121
  }
@@ -3683,7 +4130,11 @@
3683
4130
  }
3684
4131
 
3685
4132
  var res = this.spliceItemsIntoValues_(index, deleteCount, newItems);
3686
- if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice_(index, newItems, res);
4133
+
4134
+ if (deleteCount !== 0 || newItems.length !== 0) {
4135
+ this.notifyArraySplice_(index, newItems, res);
4136
+ }
4137
+
3687
4138
  return this.dehanceValues_(res);
3688
4139
  };
3689
4140
 
@@ -3726,10 +4177,19 @@
3726
4177
  } : 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
3727
4178
  // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled
3728
4179
 
3729
- if ( notifySpy) spyReportStart(change);
4180
+ if ( notifySpy) {
4181
+ spyReportStart(change);
4182
+ }
4183
+
3730
4184
  this.atom_.reportChanged();
3731
- if (notify) notifyListeners(this, change);
3732
- if ( notifySpy) spyReportEnd();
4185
+
4186
+ if (notify) {
4187
+ notifyListeners(this, change);
4188
+ }
4189
+
4190
+ if ( notifySpy) {
4191
+ spyReportEnd();
4192
+ }
3733
4193
  };
3734
4194
 
3735
4195
  _proto.notifyArraySplice_ = function notifyArraySplice_(index, added, removed) {
@@ -3746,11 +4206,20 @@
3746
4206
  removedCount: removed.length,
3747
4207
  addedCount: added.length
3748
4208
  } : null;
3749
- if ( notifySpy) spyReportStart(change);
4209
+
4210
+ if ( notifySpy) {
4211
+ spyReportStart(change);
4212
+ }
4213
+
3750
4214
  this.atom_.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe
3751
4215
 
3752
- if (notify) notifyListeners(this, change);
3753
- if ( notifySpy) spyReportEnd();
4216
+ if (notify) {
4217
+ notifyListeners(this, change);
4218
+ }
4219
+
4220
+ if ( notifySpy) {
4221
+ spyReportEnd();
4222
+ }
3754
4223
  };
3755
4224
 
3756
4225
  _proto.get_ = function get_(index) {
@@ -3777,7 +4246,11 @@
3777
4246
  index: index,
3778
4247
  newValue: newValue
3779
4248
  });
3780
- if (!change) return;
4249
+
4250
+ if (!change) {
4251
+ return;
4252
+ }
4253
+
3781
4254
  newValue = change.newValue;
3782
4255
  }
3783
4256
 
@@ -4018,6 +4491,8 @@
4018
4491
  var ObservableMap = /*#__PURE__*/function (_Symbol$iterator2, _Symbol$toStringTag2) {
4019
4492
  // hasMap, not hashMap >-).
4020
4493
  function ObservableMap(initialData, enhancer_, name_) {
4494
+ var _this = this;
4495
+
4021
4496
  if (enhancer_ === void 0) {
4022
4497
  enhancer_ = deepEnhancer;
4023
4498
  }
@@ -4045,7 +4520,9 @@
4045
4520
  this.keysAtom_ = createAtom( this.name_ + ".keys()" );
4046
4521
  this.data_ = new Map();
4047
4522
  this.hasMap_ = new Map();
4048
- this.merge(initialData);
4523
+ allowStateChanges(true, function () {
4524
+ _this.merge(initialData);
4525
+ });
4049
4526
  }
4050
4527
 
4051
4528
  var _proto = ObservableMap.prototype;
@@ -4055,16 +4532,19 @@
4055
4532
  };
4056
4533
 
4057
4534
  _proto.has = function has(key) {
4058
- var _this = this;
4535
+ var _this2 = this;
4536
+
4537
+ if (!globalState.trackingDerivation) {
4538
+ return this.has_(key);
4539
+ }
4059
4540
 
4060
- if (!globalState.trackingDerivation) return this.has_(key);
4061
4541
  var entry = this.hasMap_.get(key);
4062
4542
 
4063
4543
  if (!entry) {
4064
4544
  var newEntry = entry = new ObservableValue(this.has_(key), referenceEnhancer, this.name_ + "." + stringifyKey(key) + "?" , false);
4065
4545
  this.hasMap_.set(key, newEntry);
4066
4546
  onBecomeUnobserved(newEntry, function () {
4067
- return _this.hasMap_["delete"](key);
4547
+ return _this2.hasMap_["delete"](key);
4068
4548
  });
4069
4549
  }
4070
4550
 
@@ -4081,7 +4561,11 @@
4081
4561
  newValue: value,
4082
4562
  name: key
4083
4563
  });
4084
- if (!change) return this;
4564
+
4565
+ if (!change) {
4566
+ return this;
4567
+ }
4568
+
4085
4569
  value = change.newValue;
4086
4570
  }
4087
4571
 
@@ -4095,7 +4579,7 @@
4095
4579
  };
4096
4580
 
4097
4581
  _proto["delete"] = function _delete(key) {
4098
- var _this2 = this;
4582
+ var _this3 = this;
4099
4583
 
4100
4584
  checkIfStateModificationsAreAllowed(this.keysAtom_);
4101
4585
 
@@ -4105,7 +4589,10 @@
4105
4589
  object: this,
4106
4590
  name: key
4107
4591
  });
4108
- if (!change) return false;
4592
+
4593
+ if (!change) {
4594
+ return false;
4595
+ }
4109
4596
  }
4110
4597
 
4111
4598
  if (this.has_(key)) {
@@ -4121,23 +4608,33 @@
4121
4608
  name: key
4122
4609
  } : null;
4123
4610
 
4124
- if ( notifySpy) spyReportStart(_change); // TODO fix type
4611
+ if ( notifySpy) {
4612
+ spyReportStart(_change);
4613
+ } // TODO fix type
4614
+
4125
4615
 
4126
4616
  transaction(function () {
4127
- var _this2$hasMap_$get;
4617
+ var _this3$hasMap_$get;
4128
4618
 
4129
- _this2.keysAtom_.reportChanged();
4619
+ _this3.keysAtom_.reportChanged();
4130
4620
 
4131
- (_this2$hasMap_$get = _this2.hasMap_.get(key)) == null ? void 0 : _this2$hasMap_$get.setNewValue_(false);
4621
+ (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null ? void 0 : _this3$hasMap_$get.setNewValue_(false);
4132
4622
 
4133
- var observable = _this2.data_.get(key);
4623
+ var observable = _this3.data_.get(key);
4134
4624
 
4135
4625
  observable.setNewValue_(undefined);
4136
4626
 
4137
- _this2.data_["delete"](key);
4627
+ _this3.data_["delete"](key);
4138
4628
  });
4139
- if (notify) notifyListeners(this, _change);
4140
- if ( notifySpy) spyReportEnd();
4629
+
4630
+ if (notify) {
4631
+ notifyListeners(this, _change);
4632
+ }
4633
+
4634
+ if ( notifySpy) {
4635
+ spyReportEnd();
4636
+ }
4637
+
4141
4638
  return true;
4142
4639
  }
4143
4640
 
@@ -4160,30 +4657,40 @@
4160
4657
  name: key,
4161
4658
  newValue: newValue
4162
4659
  } : null;
4163
- if ( notifySpy) spyReportStart(change); // TODO fix type
4660
+
4661
+ if ( notifySpy) {
4662
+ spyReportStart(change);
4663
+ } // TODO fix type
4664
+
4164
4665
 
4165
4666
  observable.setNewValue_(newValue);
4166
- if (notify) notifyListeners(this, change);
4167
- if ( notifySpy) spyReportEnd();
4667
+
4668
+ if (notify) {
4669
+ notifyListeners(this, change);
4670
+ }
4671
+
4672
+ if ( notifySpy) {
4673
+ spyReportEnd();
4674
+ }
4168
4675
  }
4169
4676
  };
4170
4677
 
4171
4678
  _proto.addValue_ = function addValue_(key, newValue) {
4172
- var _this3 = this;
4679
+ var _this4 = this;
4173
4680
 
4174
4681
  checkIfStateModificationsAreAllowed(this.keysAtom_);
4175
4682
  transaction(function () {
4176
- var _this3$hasMap_$get;
4683
+ var _this4$hasMap_$get;
4177
4684
 
4178
- var observable = new ObservableValue(newValue, _this3.enhancer_, _this3.name_ + "." + stringifyKey(key) , false);
4685
+ var observable = new ObservableValue(newValue, _this4.enhancer_, _this4.name_ + "." + stringifyKey(key) , false);
4179
4686
 
4180
- _this3.data_.set(key, observable);
4687
+ _this4.data_.set(key, observable);
4181
4688
 
4182
4689
  newValue = observable.value_; // value might have been changed
4183
4690
 
4184
- (_this3$hasMap_$get = _this3.hasMap_.get(key)) == null ? void 0 : _this3$hasMap_$get.setNewValue_(true);
4691
+ (_this4$hasMap_$get = _this4.hasMap_.get(key)) == null ? void 0 : _this4$hasMap_$get.setNewValue_(true);
4185
4692
 
4186
- _this3.keysAtom_.reportChanged();
4693
+ _this4.keysAtom_.reportChanged();
4187
4694
  });
4188
4695
  var notifySpy = isSpyEnabled();
4189
4696
  var notify = hasListeners(this);
@@ -4195,14 +4702,26 @@
4195
4702
  name: key,
4196
4703
  newValue: newValue
4197
4704
  } : null;
4198
- if ( notifySpy) spyReportStart(change); // TODO fix type
4199
4705
 
4200
- if (notify) notifyListeners(this, change);
4201
- if ( notifySpy) spyReportEnd();
4706
+ if ( notifySpy) {
4707
+ spyReportStart(change);
4708
+ } // TODO fix type
4709
+
4710
+
4711
+ if (notify) {
4712
+ notifyListeners(this, change);
4713
+ }
4714
+
4715
+ if ( notifySpy) {
4716
+ spyReportEnd();
4717
+ }
4202
4718
  };
4203
4719
 
4204
4720
  _proto.get = function get(key) {
4205
- if (this.has(key)) return this.dehanceValue_(this.data_.get(key).get());
4721
+ if (this.has(key)) {
4722
+ return this.dehanceValue_(this.data_.get(key).get());
4723
+ }
4724
+
4206
4725
  return this.dehanceValue_(undefined);
4207
4726
  };
4208
4727
 
@@ -4269,45 +4788,54 @@
4269
4788
  ;
4270
4789
 
4271
4790
  _proto.merge = function merge(other) {
4272
- var _this4 = this;
4791
+ var _this5 = this;
4273
4792
 
4274
4793
  if (isObservableMap(other)) {
4275
4794
  other = new Map(other);
4276
4795
  }
4277
4796
 
4278
4797
  transaction(function () {
4279
- if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) {
4280
- return _this4.set(key, other[key]);
4281
- });else if (Array.isArray(other)) other.forEach(function (_ref) {
4282
- var key = _ref[0],
4283
- value = _ref[1];
4284
- return _this4.set(key, value);
4285
- });else if (isES6Map(other)) {
4286
- if (other.constructor !== Map) die(19, other);
4798
+ if (isPlainObject(other)) {
4799
+ getPlainObjectKeys(other).forEach(function (key) {
4800
+ return _this5.set(key, other[key]);
4801
+ });
4802
+ } else if (Array.isArray(other)) {
4803
+ other.forEach(function (_ref) {
4804
+ var key = _ref[0],
4805
+ value = _ref[1];
4806
+ return _this5.set(key, value);
4807
+ });
4808
+ } else if (isES6Map(other)) {
4809
+ if (other.constructor !== Map) {
4810
+ die(19, other);
4811
+ }
4812
+
4287
4813
  other.forEach(function (value, key) {
4288
- return _this4.set(key, value);
4814
+ return _this5.set(key, value);
4289
4815
  });
4290
- } else if (other !== null && other !== undefined) die(20, other);
4816
+ } else if (other !== null && other !== undefined) {
4817
+ die(20, other);
4818
+ }
4291
4819
  });
4292
4820
  return this;
4293
4821
  };
4294
4822
 
4295
4823
  _proto.clear = function clear() {
4296
- var _this5 = this;
4824
+ var _this6 = this;
4297
4825
 
4298
4826
  transaction(function () {
4299
4827
  untracked(function () {
4300
- for (var _iterator2 = _createForOfIteratorHelperLoose(_this5.keys()), _step2; !(_step2 = _iterator2()).done;) {
4828
+ for (var _iterator2 = _createForOfIteratorHelperLoose(_this6.keys()), _step2; !(_step2 = _iterator2()).done;) {
4301
4829
  var key = _step2.value;
4302
4830
 
4303
- _this5["delete"](key);
4831
+ _this6["delete"](key);
4304
4832
  }
4305
4833
  });
4306
4834
  });
4307
4835
  };
4308
4836
 
4309
4837
  _proto.replace = function replace(values) {
4310
- var _this6 = this;
4838
+ var _this7 = this;
4311
4839
 
4312
4840
  // Implementation requirements:
4313
4841
  // - respect ordering of replacement map
@@ -4324,13 +4852,13 @@
4324
4852
  // if the key deletion is prevented by interceptor
4325
4853
  // add entry at the beginning of the result map
4326
4854
 
4327
- for (var _iterator3 = _createForOfIteratorHelperLoose(_this6.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {
4855
+ for (var _iterator3 = _createForOfIteratorHelperLoose(_this7.data_.keys()), _step3; !(_step3 = _iterator3()).done;) {
4328
4856
  var key = _step3.value;
4329
4857
 
4330
4858
  // Concurrently iterating/deleting keys
4331
4859
  // iterator should handle this correctly
4332
4860
  if (!replacementMap.has(key)) {
4333
- var deleted = _this6["delete"](key); // Was the key removed?
4861
+ var deleted = _this7["delete"](key); // Was the key removed?
4334
4862
 
4335
4863
 
4336
4864
  if (deleted) {
@@ -4338,7 +4866,7 @@
4338
4866
  keysReportChangedCalled = true;
4339
4867
  } else {
4340
4868
  // Delete prevented by interceptor
4341
- var value = _this6.data_.get(key);
4869
+ var value = _this7.data_.get(key);
4342
4870
 
4343
4871
  orderedData.set(key, value);
4344
4872
  }
@@ -4352,17 +4880,17 @@
4352
4880
  _value = _step4$value[1];
4353
4881
 
4354
4882
  // We will want to know whether a new key is added
4355
- var keyExisted = _this6.data_.has(_key); // Add or update value
4883
+ var keyExisted = _this7.data_.has(_key); // Add or update value
4356
4884
 
4357
4885
 
4358
- _this6.set(_key, _value); // The addition could have been prevent by interceptor
4886
+ _this7.set(_key, _value); // The addition could have been prevent by interceptor
4359
4887
 
4360
4888
 
4361
- if (_this6.data_.has(_key)) {
4889
+ if (_this7.data_.has(_key)) {
4362
4890
  // The update could have been prevented by interceptor
4363
4891
  // and also we want to preserve existing values
4364
4892
  // so use value from _data map (instead of replacement map)
4365
- var _value2 = _this6.data_.get(_key);
4893
+ var _value2 = _this7.data_.get(_key);
4366
4894
 
4367
4895
  orderedData.set(_key, _value2); // Was a new key added?
4368
4896
 
@@ -4375,11 +4903,11 @@
4375
4903
 
4376
4904
 
4377
4905
  if (!keysReportChangedCalled) {
4378
- if (_this6.data_.size !== orderedData.size) {
4906
+ if (_this7.data_.size !== orderedData.size) {
4379
4907
  // If size differs, keys are definitely modified
4380
- _this6.keysAtom_.reportChanged();
4908
+ _this7.keysAtom_.reportChanged();
4381
4909
  } else {
4382
- var iter1 = _this6.data_.keys();
4910
+ var iter1 = _this7.data_.keys();
4383
4911
 
4384
4912
  var iter2 = orderedData.keys();
4385
4913
  var next1 = iter1.next();
@@ -4387,7 +4915,7 @@
4387
4915
 
4388
4916
  while (!next1.done) {
4389
4917
  if (next1.value !== next2.value) {
4390
- _this6.keysAtom_.reportChanged();
4918
+ _this7.keysAtom_.reportChanged();
4391
4919
 
4392
4920
  break;
4393
4921
  }
@@ -4399,7 +4927,7 @@
4399
4927
  } // Use correctly ordered map
4400
4928
 
4401
4929
 
4402
- _this6.data_ = orderedData;
4930
+ _this7.data_ = orderedData;
4403
4931
  });
4404
4932
  return this;
4405
4933
  };
@@ -4418,7 +4946,10 @@
4418
4946
  * for callback details
4419
4947
  */
4420
4948
  _proto.observe_ = function observe_(listener, fireImmediately) {
4421
- if ( fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with maps.");
4949
+ if ( fireImmediately === true) {
4950
+ die("`observe` doesn't support fireImmediately=true in combination with maps.");
4951
+ }
4952
+
4422
4953
  return registerListener(this, listener);
4423
4954
  };
4424
4955
 
@@ -4543,8 +5074,12 @@
4543
5074
  object: this,
4544
5075
  newValue: value
4545
5076
  });
4546
- if (!change) return this; // ideally, value = change.value would be done here, so that values can be
5077
+
5078
+ if (!change) {
5079
+ return this;
5080
+ } // ideally, value = change.value would be done here, so that values can be
4547
5081
  // changed by interceptor. Same applies for other Set and Map api's.
5082
+
4548
5083
  }
4549
5084
 
4550
5085
  if (!this.has(value)) {
@@ -4564,9 +5099,17 @@
4564
5099
  newValue: value
4565
5100
  } : null;
4566
5101
 
4567
- if (notifySpy && "development" !== "production") spyReportStart(_change);
4568
- if (notify) notifyListeners(this, _change);
4569
- if (notifySpy && "development" !== "production") spyReportEnd();
5102
+ if (notifySpy && "development" !== "production") {
5103
+ spyReportStart(_change);
5104
+ }
5105
+
5106
+ if (notify) {
5107
+ notifyListeners(this, _change);
5108
+ }
5109
+
5110
+ if (notifySpy && "development" !== "production") {
5111
+ spyReportEnd();
5112
+ }
4570
5113
  }
4571
5114
 
4572
5115
  return this;
@@ -4581,7 +5124,10 @@
4581
5124
  object: this,
4582
5125
  oldValue: value
4583
5126
  });
4584
- if (!change) return false;
5127
+
5128
+ if (!change) {
5129
+ return false;
5130
+ }
4585
5131
  }
4586
5132
 
4587
5133
  if (this.has(value)) {
@@ -4596,14 +5142,24 @@
4596
5142
  oldValue: value
4597
5143
  } : null;
4598
5144
 
4599
- if (notifySpy && "development" !== "production") spyReportStart(_change2);
5145
+ if (notifySpy && "development" !== "production") {
5146
+ spyReportStart(_change2);
5147
+ }
5148
+
4600
5149
  transaction(function () {
4601
5150
  _this3.atom_.reportChanged();
4602
5151
 
4603
5152
  _this3.data_["delete"](value);
4604
5153
  });
4605
- if (notify) notifyListeners(this, _change2);
4606
- if (notifySpy && "development" !== "production") spyReportEnd();
5154
+
5155
+ if (notify) {
5156
+ notifyListeners(this, _change2);
5157
+ }
5158
+
5159
+ if (notifySpy && "development" !== "production") {
5160
+ spyReportEnd();
5161
+ }
5162
+
4607
5163
  return true;
4608
5164
  }
4609
5165
 
@@ -4683,7 +5239,10 @@
4683
5239
 
4684
5240
  _proto.observe_ = function observe_(listener, fireImmediately) {
4685
5241
  // ... 'fireImmediately' could also be true?
4686
- if ( fireImmediately === true) die("`observe` doesn't support fireImmediately=true in combination with sets.");
5242
+ if ( fireImmediately === true) {
5243
+ die("`observe` doesn't support fireImmediately=true in combination with sets.");
5244
+ }
5245
+
4687
5246
  return registerListener(this, listener);
4688
5247
  };
4689
5248
 
@@ -4785,7 +5344,11 @@
4785
5344
  name: key,
4786
5345
  newValue: newValue
4787
5346
  });
4788
- if (!change) return null;
5347
+
5348
+ if (!change) {
5349
+ return null;
5350
+ }
5351
+
4789
5352
  newValue = change.newValue;
4790
5353
  }
4791
5354
 
@@ -4805,10 +5368,18 @@
4805
5368
  newValue: newValue
4806
5369
  } : null;
4807
5370
 
4808
- if ( notifySpy) spyReportStart(_change);
5371
+ if ( notifySpy) {
5372
+ spyReportStart(_change);
5373
+ }
4809
5374
  observable.setNewValue_(newValue);
4810
- if (notify) notifyListeners(this, _change);
4811
- if ( notifySpy) spyReportEnd();
5375
+
5376
+ if (notify) {
5377
+ notifyListeners(this, _change);
5378
+ }
5379
+
5380
+ if ( notifySpy) {
5381
+ spyReportEnd();
5382
+ }
4812
5383
  }
4813
5384
 
4814
5385
  return true;
@@ -4917,12 +5488,18 @@
4917
5488
 
4918
5489
  if (descriptor) {
4919
5490
  var outcome = annotation.make_(this, key, descriptor, source);
5491
+
4920
5492
  if (outcome === 0
4921
5493
  /* Cancel */
4922
- ) return;
5494
+ ) {
5495
+ return;
5496
+ }
5497
+
4923
5498
  if (outcome === 1
4924
5499
  /* Break */
4925
- ) break;
5500
+ ) {
5501
+ break;
5502
+ }
4926
5503
  }
4927
5504
 
4928
5505
  source = Object.getPrototypeOf(source);
@@ -4992,7 +5569,11 @@
4992
5569
  type: ADD,
4993
5570
  newValue: descriptor.value
4994
5571
  });
4995
- if (!change) return null;
5572
+
5573
+ if (!change) {
5574
+ return null;
5575
+ }
5576
+
4996
5577
  var newValue = change.newValue;
4997
5578
 
4998
5579
  if (descriptor.value !== newValue) {
@@ -5044,7 +5625,11 @@
5044
5625
  type: ADD,
5045
5626
  newValue: value
5046
5627
  });
5047
- if (!change) return null;
5628
+
5629
+ if (!change) {
5630
+ return null;
5631
+ }
5632
+
5048
5633
  value = change.newValue;
5049
5634
  }
5050
5635
 
@@ -5099,7 +5684,10 @@
5099
5684
  type: ADD,
5100
5685
  newValue: undefined
5101
5686
  });
5102
- if (!change) return null;
5687
+
5688
+ if (!change) {
5689
+ return null;
5690
+ }
5103
5691
  }
5104
5692
 
5105
5693
  options.name || (options.name = "development" !== "production" ? this.name_ + "." + key.toString() : "ObservableObject.key");
@@ -5155,7 +5743,9 @@
5155
5743
  type: REMOVE
5156
5744
  }); // Cancelled
5157
5745
 
5158
- if (!change) return null;
5746
+ if (!change) {
5747
+ return null;
5748
+ }
5159
5749
  } // Delete
5160
5750
 
5161
5751
 
@@ -5216,9 +5806,18 @@
5216
5806
  oldValue: value,
5217
5807
  name: key
5218
5808
  };
5219
- if ("development" !== "production" && notifySpy) spyReportStart(_change2);
5220
- if (notify) notifyListeners(this, _change2);
5221
- if ("development" !== "production" && notifySpy) spyReportEnd();
5809
+
5810
+ if ("development" !== "production" && notifySpy) {
5811
+ spyReportStart(_change2);
5812
+ }
5813
+
5814
+ if (notify) {
5815
+ notifyListeners(this, _change2);
5816
+ }
5817
+
5818
+ if ("development" !== "production" && notifySpy) {
5819
+ spyReportEnd();
5820
+ }
5222
5821
  }
5223
5822
  } finally {
5224
5823
  endBatch();
@@ -5234,7 +5833,10 @@
5234
5833
  ;
5235
5834
 
5236
5835
  _proto.observe_ = function observe_(callback, fireImmediately) {
5237
- if ( fireImmediately === true) die("`observe` doesn't support the fire immediately property for observable objects.");
5836
+ if ( fireImmediately === true) {
5837
+ die("`observe` doesn't support the fire immediately property for observable objects.");
5838
+ }
5839
+
5238
5840
  return registerListener(this, callback);
5239
5841
  };
5240
5842
 
@@ -5257,9 +5859,18 @@
5257
5859
  name: key,
5258
5860
  newValue: value
5259
5861
  } : null;
5260
- if ( notifySpy) spyReportStart(change);
5261
- if (notify) notifyListeners(this, change);
5262
- if ( notifySpy) spyReportEnd();
5862
+
5863
+ if ( notifySpy) {
5864
+ spyReportStart(change);
5865
+ }
5866
+
5867
+ if (notify) {
5868
+ notifyListeners(this, change);
5869
+ }
5870
+
5871
+ if ( notifySpy) {
5872
+ spyReportEnd();
5873
+ }
5263
5874
  }
5264
5875
 
5265
5876
  (_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
@@ -5300,7 +5911,10 @@
5300
5911
  return target;
5301
5912
  }
5302
5913
 
5303
- if ( !Object.isExtensible(target)) die("Cannot make the designated object observable; it is not extensible");
5914
+ if ( !Object.isExtensible(target)) {
5915
+ die("Cannot make the designated object observable; it is not extensible");
5916
+ }
5917
+
5304
5918
  var name = (_options$name = options == null ? void 0 : options.name) != null ? _options$name : (isPlainObject(target) ? "ObservableObject" : target.constructor.name) + "@" + getNextId() ;
5305
5919
  var adm = new ObservableObjectAdministration(target, new Map(), String(name), getAnnotationFromOptions(options));
5306
5920
  addHiddenProp(target, $mobx, adm);
@@ -5457,7 +6071,6 @@
5457
6071
  var nextIndex = 0;
5458
6072
  return makeIterable({
5459
6073
  next: function next() {
5460
- // @ts-ignore
5461
6074
  return nextIndex < self.length ? {
5462
6075
  value: self[nextIndex++],
5463
6076
  done: false
@@ -5490,7 +6103,10 @@
5490
6103
  Object.entries(arrayExtensions).forEach(function (_ref) {
5491
6104
  var prop = _ref[0],
5492
6105
  fn = _ref[1];
5493
- if (prop !== "concat") addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6106
+
6107
+ if (prop !== "concat") {
6108
+ addHiddenProp(LegacyObservableArray.prototype, prop, fn);
6109
+ }
5494
6110
  });
5495
6111
 
5496
6112
  function createArrayEntryDescriptor(index) {
@@ -5527,7 +6143,10 @@
5527
6143
  function getAtom(thing, property) {
5528
6144
  if (typeof thing === "object" && thing !== null) {
5529
6145
  if (isObservableArray(thing)) {
5530
- if (property !== undefined) die(23);
6146
+ if (property !== undefined) {
6147
+ die(23);
6148
+ }
6149
+
5531
6150
  return thing[$mobx].atom_;
5532
6151
  }
5533
6152
 
@@ -5536,18 +6155,31 @@
5536
6155
  }
5537
6156
 
5538
6157
  if (isObservableMap(thing)) {
5539
- if (property === undefined) return thing.keysAtom_;
6158
+ if (property === undefined) {
6159
+ return thing.keysAtom_;
6160
+ }
6161
+
5540
6162
  var observable = thing.data_.get(property) || thing.hasMap_.get(property);
5541
- if (!observable) die(25, property, getDebugName(thing));
6163
+
6164
+ if (!observable) {
6165
+ die(25, property, getDebugName(thing));
6166
+ }
6167
+
5542
6168
  return observable;
5543
6169
  }
5544
6170
 
6171
+
5545
6172
  if (isObservableObject(thing)) {
5546
- if (!property) return die(26);
6173
+ if (!property) {
6174
+ return die(26);
6175
+ }
5547
6176
 
5548
6177
  var _observable = thing[$mobx].values_.get(property);
5549
6178
 
5550
- if (!_observable) die(27, property, getDebugName(thing));
6179
+ if (!_observable) {
6180
+ die(27, property, getDebugName(thing));
6181
+ }
6182
+
5551
6183
  return _observable;
5552
6184
  }
5553
6185
 
@@ -5564,11 +6196,26 @@
5564
6196
  die(28);
5565
6197
  }
5566
6198
  function getAdministration(thing, property) {
5567
- if (!thing) die(29);
5568
- if (property !== undefined) return getAdministration(getAtom(thing, property));
5569
- if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing;
5570
- if (isObservableMap(thing) || isObservableSet(thing)) return thing;
5571
- if (thing[$mobx]) return thing[$mobx];
6199
+ if (!thing) {
6200
+ die(29);
6201
+ }
6202
+
6203
+ if (property !== undefined) {
6204
+ return getAdministration(getAtom(thing, property));
6205
+ }
6206
+
6207
+ if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) {
6208
+ return thing;
6209
+ }
6210
+
6211
+ if (isObservableMap(thing) || isObservableSet(thing)) {
6212
+ return thing;
6213
+ }
6214
+
6215
+ if (thing[$mobx]) {
6216
+ return thing[$mobx];
6217
+ }
6218
+
5572
6219
  die(24, thing);
5573
6220
  }
5574
6221
  function getDebugName(thing, property) {
@@ -5601,17 +6248,33 @@
5601
6248
  function eq(a, b, depth, aStack, bStack) {
5602
6249
  // Identical objects are equal. `0 === -0`, but they aren't identical.
5603
6250
  // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
5604
- if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison).
6251
+ if (a === b) {
6252
+ return a !== 0 || 1 / a === 1 / b;
6253
+ } // `null` or `undefined` only equal to itself (strict comparison).
5605
6254
 
5606
- if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive.
5607
6255
 
5608
- if (a !== a) return b !== b; // Exhaust primitive checks
6256
+ if (a == null || b == null) {
6257
+ return false;
6258
+ } // `NaN`s are equivalent, but non-reflexive.
6259
+
6260
+
6261
+ if (a !== a) {
6262
+ return b !== b;
6263
+ } // Exhaust primitive checks
6264
+
5609
6265
 
5610
6266
  var type = typeof a;
5611
- if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names.
6267
+
6268
+ if (type !== "function" && type !== "object" && typeof b != "object") {
6269
+ return false;
6270
+ } // Compare `[[Class]]` names.
6271
+
5612
6272
 
5613
6273
  var className = toString.call(a);
5614
- if (className !== toString.call(b)) return false;
6274
+
6275
+ if (className !== toString.call(b)) {
6276
+ return false;
6277
+ }
5615
6278
 
5616
6279
  switch (className) {
5617
6280
  // Strings, numbers, regular expressions, dates, and booleans are compared by value.
@@ -5625,7 +6288,10 @@
5625
6288
  case "[object Number]":
5626
6289
  // `NaN`s are equivalent, but non-reflexive.
5627
6290
  // Object(NaN) is equivalent to NaN.
5628
- if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values.
6291
+ if (+a !== +a) {
6292
+ return +b !== +b;
6293
+ } // An `egal` comparison is performed for other numeric values.
6294
+
5629
6295
 
5630
6296
  return +a === 0 ? 1 / +a === 1 / b : +a === +b;
5631
6297
 
@@ -5656,9 +6322,12 @@
5656
6322
  var areArrays = className === "[object Array]";
5657
6323
 
5658
6324
  if (!areArrays) {
5659
- if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s
6325
+ if (typeof a != "object" || typeof b != "object") {
6326
+ return false;
6327
+ } // Objects with different constructors are not equivalent, but `Object`s or `Array`s
5660
6328
  // from different frames are.
5661
6329
 
6330
+
5662
6331
  var aCtor = a.constructor,
5663
6332
  bCtor = b.constructor;
5664
6333
 
@@ -5684,7 +6353,9 @@
5684
6353
  while (length--) {
5685
6354
  // Linear search. Performance is inversely proportional to the number of
5686
6355
  // unique nested structures.
5687
- if (aStack[length] === a) return bStack[length] === b;
6356
+ if (aStack[length] === a) {
6357
+ return bStack[length] === b;
6358
+ }
5688
6359
  } // Add the first object to the stack of traversed objects.
5689
6360
 
5690
6361
 
@@ -5694,10 +6365,16 @@
5694
6365
  if (areArrays) {
5695
6366
  // Compare array lengths to determine if a deep comparison is necessary.
5696
6367
  length = a.length;
5697
- if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties.
6368
+
6369
+ if (length !== b.length) {
6370
+ return false;
6371
+ } // Deep compare the contents, ignoring non-numeric properties.
6372
+
5698
6373
 
5699
6374
  while (length--) {
5700
- if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false;
6375
+ if (!eq(a[length], b[length], depth - 1, aStack, bStack)) {
6376
+ return false;
6377
+ }
5701
6378
  }
5702
6379
  } else {
5703
6380
  // Deep compare objects.
@@ -5705,12 +6382,17 @@
5705
6382
  var key;
5706
6383
  length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
5707
6384
 
5708
- if (Object.keys(b).length !== length) return false;
6385
+ if (Object.keys(b).length !== length) {
6386
+ return false;
6387
+ }
5709
6388
 
5710
6389
  while (length--) {
5711
6390
  // Deep compare each member
5712
6391
  key = keys[length];
5713
- if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false;
6392
+
6393
+ if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
6394
+ return false;
6395
+ }
5714
6396
  }
5715
6397
  } // Remove the first object from the stack of traversed objects.
5716
6398
 
@@ -5721,9 +6403,18 @@
5721
6403
  }
5722
6404
 
5723
6405
  function unwrap(a) {
5724
- if (isObservableArray(a)) return a.slice();
5725
- if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries());
5726
- if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries());
6406
+ if (isObservableArray(a)) {
6407
+ return a.slice();
6408
+ }
6409
+
6410
+ if (isES6Map(a) || isObservableMap(a)) {
6411
+ return Array.from(a.entries());
6412
+ }
6413
+
6414
+ if (isES6Set(a) || isObservableSet(a)) {
6415
+ return Array.from(a.entries());
6416
+ }
6417
+
5727
6418
  return a;
5728
6419
  }
5729
6420