@typeberry/convert 0.9.0-3f2c45b → 0.9.0-6850f84

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 (3) hide show
  1. package/index.js +11 -4
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -5033,6 +5033,7 @@ function isResult(x) {
5033
5033
 
5034
5034
 
5035
5035
 
5036
+
5036
5037
  // EXTERNAL MODULE: ./node_modules/minimist/index.js
5037
5038
  var minimist = __nccwpck_require__(595);
5038
5039
  var minimist_default = /*#__PURE__*/__nccwpck_require__.n(minimist);
@@ -8831,9 +8832,11 @@ class SortedArray {
8831
8832
  removeOne(v) {
8832
8833
  const findIdx = this.binarySearch(v);
8833
8834
  if (findIdx.isEqual) {
8834
- // remove the element
8835
- this.array.splice(findIdx.idx, 1);
8835
+ // remove the element and return the stored one
8836
+ const [removed] = this.array.splice(findIdx.idx, 1);
8837
+ return removed;
8836
8838
  }
8839
+ return undefined;
8837
8840
  }
8838
8841
  has(v) {
8839
8842
  return this.binarySearch(v).isEqual;
@@ -8988,8 +8991,12 @@ class SortedSet extends SortedArray {
8988
8991
  */
8989
8992
  replace(v) {
8990
8993
  const findIdx = this.binarySearch(v);
8991
- const toRemove = findIdx.isEqual ? 1 : 0;
8992
- this.array.splice(findIdx.idx, toRemove, v);
8994
+ if (findIdx.isEqual) {
8995
+ const [displaced] = this.array.splice(findIdx.idx, 1, v);
8996
+ return displaced;
8997
+ }
8998
+ this.array.splice(findIdx.idx, 0, v);
8999
+ return undefined;
8993
9000
  }
8994
9001
  /** Create a new SortedSet from two sorted collections. */
8995
9002
  static fromTwoSortedCollections(first, second) {