@baleada/logic 0.20.28 → 0.20.29
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.
- package/lib/index.cjs +4 -10
- package/lib/index.d.ts +2 -2
- package/lib/index.js +4 -10
- package/package.json +1 -1
package/lib/index.cjs
CHANGED
|
@@ -2784,10 +2784,7 @@ class Navigateable {
|
|
|
2784
2784
|
this.computedLocation = ensuredLocation;
|
|
2785
2785
|
}
|
|
2786
2786
|
next(options = {}) {
|
|
2787
|
-
const { distance, loops
|
|
2788
|
-
if (allow === "any") {
|
|
2789
|
-
return this.location + distance;
|
|
2790
|
-
}
|
|
2787
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2791
2788
|
const lastLocation = this.array.length - 1;
|
|
2792
2789
|
if (this.location + distance <= lastLocation) {
|
|
2793
2790
|
return this.location + distance;
|
|
@@ -2803,7 +2800,7 @@ class Navigateable {
|
|
|
2803
2800
|
return newLocation2;
|
|
2804
2801
|
})();
|
|
2805
2802
|
})();
|
|
2806
|
-
this._navigate(newLocation
|
|
2803
|
+
this._navigate(newLocation);
|
|
2807
2804
|
this.nexted();
|
|
2808
2805
|
return this;
|
|
2809
2806
|
}
|
|
@@ -2811,10 +2808,7 @@ class Navigateable {
|
|
|
2811
2808
|
this.computedStatus = "navigated to next";
|
|
2812
2809
|
}
|
|
2813
2810
|
previous(options = {}) {
|
|
2814
|
-
const { distance, loops
|
|
2815
|
-
if (allow === "any") {
|
|
2816
|
-
return this.location - distance;
|
|
2817
|
-
}
|
|
2811
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2818
2812
|
if (this.location - distance >= 0) {
|
|
2819
2813
|
return this.location - distance;
|
|
2820
2814
|
}
|
|
@@ -2829,7 +2823,7 @@ class Navigateable {
|
|
|
2829
2823
|
return newLocation2;
|
|
2830
2824
|
})();
|
|
2831
2825
|
})();
|
|
2832
|
-
this._navigate(newLocation
|
|
2826
|
+
this._navigate(newLocation);
|
|
2833
2827
|
this.previoused();
|
|
2834
2828
|
return this;
|
|
2835
2829
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -728,9 +728,9 @@ declare class Navigateable<Item> {
|
|
|
728
728
|
navigate(location: number, options?: NavigateOptions): this;
|
|
729
729
|
private navigated;
|
|
730
730
|
private _navigate;
|
|
731
|
-
next(options?: NextAndPreviousOptions
|
|
731
|
+
next(options?: NextAndPreviousOptions): this;
|
|
732
732
|
private nexted;
|
|
733
|
-
previous(options?: NextAndPreviousOptions
|
|
733
|
+
previous(options?: NextAndPreviousOptions): this;
|
|
734
734
|
private previoused;
|
|
735
735
|
random(): this;
|
|
736
736
|
private randomed;
|
package/lib/index.js
CHANGED
|
@@ -2773,10 +2773,7 @@ class Navigateable {
|
|
|
2773
2773
|
this.computedLocation = ensuredLocation;
|
|
2774
2774
|
}
|
|
2775
2775
|
next(options = {}) {
|
|
2776
|
-
const { distance, loops
|
|
2777
|
-
if (allow === "any") {
|
|
2778
|
-
return this.location + distance;
|
|
2779
|
-
}
|
|
2776
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2780
2777
|
const lastLocation = this.array.length - 1;
|
|
2781
2778
|
if (this.location + distance <= lastLocation) {
|
|
2782
2779
|
return this.location + distance;
|
|
@@ -2792,7 +2789,7 @@ class Navigateable {
|
|
|
2792
2789
|
return newLocation2;
|
|
2793
2790
|
})();
|
|
2794
2791
|
})();
|
|
2795
|
-
this._navigate(newLocation
|
|
2792
|
+
this._navigate(newLocation);
|
|
2796
2793
|
this.nexted();
|
|
2797
2794
|
return this;
|
|
2798
2795
|
}
|
|
@@ -2800,10 +2797,7 @@ class Navigateable {
|
|
|
2800
2797
|
this.computedStatus = "navigated to next";
|
|
2801
2798
|
}
|
|
2802
2799
|
previous(options = {}) {
|
|
2803
|
-
const { distance, loops
|
|
2804
|
-
if (allow === "any") {
|
|
2805
|
-
return this.location - distance;
|
|
2806
|
-
}
|
|
2800
|
+
const { distance, loops } = { ...defaultNextAndPreviousOptions, ...options }, newLocation = (() => {
|
|
2807
2801
|
if (this.location - distance >= 0) {
|
|
2808
2802
|
return this.location - distance;
|
|
2809
2803
|
}
|
|
@@ -2818,7 +2812,7 @@ class Navigateable {
|
|
|
2818
2812
|
return newLocation2;
|
|
2819
2813
|
})();
|
|
2820
2814
|
})();
|
|
2821
|
-
this._navigate(newLocation
|
|
2815
|
+
this._navigate(newLocation);
|
|
2822
2816
|
this.previoused();
|
|
2823
2817
|
return this;
|
|
2824
2818
|
}
|