@wewatch/lexorank
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @wewatch/lexorank

Weekly Downloads

284

Version

1.0.3

License

Apache-2.0

Unpacked Size

233 kB

Total Files

107

Last publish

Collaborators

  • ducminh