MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / between

Method between

src/bases/sortOrderUtils.ts:85–97  ·  view source on GitHub ↗
(other: RankLike)

Source from the content-addressed store, hash-verified

83 }
84
85 between(other: RankLike): RankLike {
86 const otherValue = decodeAlphaRank(other.toString());
87 if (otherValue === null) {
88 throw new Error("Cannot generate alpha midpoint against a non-alpha rank");
89 }
90 const lower = Math.min(this.value, otherValue);
91 const upper = Math.max(this.value, otherValue);
92 const midpoint = Math.floor((lower + upper) / 2);
93 if (midpoint <= lower || midpoint >= upper) {
94 throw new Error("No alpha rank gap available");
95 }
96 return new AlphaRank(midpoint);
97 }
98
99 isMax(): boolean {
100 return this.value >= ALPHA_RANK_MAX;

Callers 3

safeGenNextFunction · 0.45
safeGenPrevFunction · 0.45
safeBetweenFunction · 0.45

Calls 2

decodeAlphaRankFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected