mobx 6.13.5 → 6.13.7

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.
@@ -4684,8 +4684,8 @@
4684
4684
  if (!change) {
4685
4685
  return this;
4686
4686
  }
4687
- // ideally, value = change.value would be done here, so that values can be
4688
- // changed by interceptor. Same applies for other Set and Map api's.
4687
+ // implemented reassignment same as it's done for ObservableMap
4688
+ value = change.newValue;
4689
4689
  }
4690
4690
  if (!this.has(value)) {
4691
4691
  transaction(function () {
@@ -4757,19 +4757,18 @@
4757
4757
  return this.data_.has(this.dehanceValue_(value));
4758
4758
  };
4759
4759
  _proto.entries = function entries() {
4760
- var nextIndex = 0;
4761
- var keys = Array.from(this.keys());
4762
- var values = Array.from(this.values());
4760
+ var values = this.values();
4763
4761
  return makeIterableForSet({
4764
4762
  next: function next() {
4765
- var index = nextIndex;
4766
- nextIndex += 1;
4767
- return index < values.length ? {
4768
- value: [keys[index], values[index]],
4769
- done: false
4763
+ var _values$next = values.next(),
4764
+ value = _values$next.value,
4765
+ done = _values$next.done;
4766
+ return !done ? {
4767
+ value: [value, value],
4768
+ done: done
4770
4769
  } : {
4771
4770
  value: undefined,
4772
- done: true
4771
+ done: done
4773
4772
  };
4774
4773
  }
4775
4774
  });
@@ -4780,16 +4779,18 @@
4780
4779
  _proto.values = function values() {
4781
4780
  this.atom_.reportObserved();
4782
4781
  var self = this;
4783
- var nextIndex = 0;
4784
- var observableValues = Array.from(this.data_.values());
4782
+ var values = this.data_.values();
4785
4783
  return makeIterableForSet({
4786
4784
  next: function next() {
4787
- return nextIndex < observableValues.length ? {
4788
- value: self.dehanceValue_(observableValues[nextIndex++]),
4789
- done: false
4785
+ var _values$next2 = values.next(),
4786
+ value = _values$next2.value,
4787
+ done = _values$next2.done;
4788
+ return !done ? {
4789
+ value: self.dehanceValue_(value),
4790
+ done: done
4790
4791
  } : {
4791
4792
  value: undefined,
4792
- done: true
4793
+ done: done
4793
4794
  };
4794
4795
  }
4795
4796
  });
@@ -5739,6 +5740,8 @@
5739
5740
  return eq(a, b, depth);
5740
5741
  }
5741
5742
  // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289
5743
+ // Modified: "Deep compare objects" part to iterate over keys in forward order instead of reverse order.
5744
+ //
5742
5745
  // Internal recursive comparison function for `isEqual`.
5743
5746
  function eq(a, b, depth, aStack, bStack) {
5744
5747
  // Identical objects are equal. `0 === -0`, but they aren't identical.
@@ -5851,15 +5854,14 @@
5851
5854
  } else {
5852
5855
  // Deep compare objects.
5853
5856
  var keys = Object.keys(a);
5854
- var key;
5855
- length = keys.length;
5857
+ var _length = keys.length;
5856
5858
  // Ensure that both objects contain the same number of properties before comparing deep equality.
5857
- if (Object.keys(b).length !== length) {
5859
+ if (Object.keys(b).length !== _length) {
5858
5860
  return false;
5859
5861
  }
5860
- while (length--) {
5862
+ for (var i = 0; i < _length; i++) {
5861
5863
  // Deep compare each member
5862
- key = keys[length];
5864
+ var key = keys[i];
5863
5865
  if (!(hasProp(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) {
5864
5866
  return false;
5865
5867
  }