Skip to content

goabstract/fractional-index

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fractional-index

A Javascript implementation of fractional indexes for sorting items, as described originally in: https://observablehq.com/@dgreensp/implementing-fractional-indexing

Given two indexes the library will always return a fractional index at the midpoint between the two. This is particularly useful for realtime collaboration and cases where sending an entire set of ordered items back to the server is undesirable.

Install

npm install fractional-index

or

yarn add fractional-index

Usage

import fractionalIndex from "fractional-index";

const index = fractionalIndex("a", "b");

For start and end of a list pass null as the argument, eg:

import fractionalIndex from "fractional-index";

const index = fractionalIndex("a", null);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published