1.0.3 • Published 3 years ago

@wewatch/lexorank v1.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

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

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

0.0.1-rc4

3 years ago

0.0.1-rc3

3 years ago

0.0.1-rc2

3 years ago

0.0.1-rc1

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago