A reference implementation of a list ordering system like JIRA's Lexorank algorithm. This project is a fork from lexorank-ts with modifications to allow customizations.
-
npm
npm install @wewatch/lexorank
-
yarn
yarn add @wewatch/lexorank
import { LexoRank } from "@wewatch/lexorank";
// min
const minLexoRank = LexoRank.min();
// max
const maxLexoRank = LexoRank.max();
// middle
const midLexoRank = LexoRank.middle();
// parse
const parsedLexoRank = LexoRank.parse("0|0i0000:");
import { LexoRank } from "@wewatch/lexorank";
// any lexoRank
const lexoRank = LexoRank.middle();
// generate next lexorank
const nextLexoRank = lexoRank.genNext();
// generate previous lexorank
const prevLexoRank = lexoRank.genPrev();
// toString
const lexoRankStr = lexoRank.toString();
LexRank calculation based on existing LexoRanks.
import { LexoRank } from "@wewatch/lexorank";
// any lexorank
const rank1 = LexoRank.min();
// another lexorank
const rank2 = rank1.genNext().genNext();
// calculate between
const betweenLexoRank = rank1.between(rank2);
import { buildLexoRank, NumeralSystem64 } from "@wewatch/lexorank";
const LexoRank = buildLexoRank({
NumeralSystem: NumeralSystem64,
maxOrder: 8,
initialMinDecimal: "1000",
defaultGap: "1000",
});
Apache-2.0