Skip to content

Latest commit

 

History

History
103 lines (69 loc) · 1.98 KB

README.md

File metadata and controls

103 lines (69 loc) · 1.98 KB

LexoRank

CI Coverage Status

Table of Contents

About

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.

Installation

  • npm

    npm install @wewatch/lexorank
  • yarn

    yarn add @wewatch/lexorank

Usage

Static methods

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:");

Public methods

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();

Calculate LexoRank

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);

Customize

import { buildLexoRank, NumeralSystem64 } from "@wewatch/lexorank";

const LexoRank = buildLexoRank({
  NumeralSystem: NumeralSystem64,
  maxOrder: 8,
  initialMinDecimal: "1000",
  defaultGap: "1000",
});

License

Apache-2.0