Skip to content

Utility methods to generate rank string values for arbitrarily ranking values in a database

Notifications You must be signed in to change notification settings

azmenak/string-rank

Repository files navigation

String Rank

Provides utility methods needed to use a string value as a "rank" in a database.

Inspired by this Stack Overflow answer. Here we expose two simple methods which should allow use of string ranks.

  1. increaseRank(rank: string, by: number): string
    Which can be used to fill existing rows in a database by simply iterating and increasing each value by a given ammount.
  2. moveBetween(rankA: string, rankB: string): string
    Which simply returns a new rank string at the halfway distance between the two provided values. This allow us to simply update a single record in a database to arbitrarily rank rows.

About

Utility methods to generate rank string values for arbitrarily ranking values in a database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published