Skip to content

Library for generating short string keys for keeping objects in lists in order

License

Notifications You must be signed in to change notification settings

antonsimola/FractionalIndexing

Repository files navigation

Fractional Indexing

Nuget

This is based on JS implementation by rocicorp which in turn is based on Implementing Fractional Indexing by David Greenspan .

Use it to generate short string keys which help maintain ordered lists.

For example when reordering to-do items, drag and dropping between items, or as last / first one.

Usage

var key1 = OrderKeyGenerator.GenerateKeyBetween(null, null); // to get started
var key2 = OrderKeyGenerator.GenerateKeyBetween(key1, null); // after key1
var key3 = OrderKeyGenerator.GenerateKeyBetween(key1, key2); // between key1 and key2
var key0 = OrderKeyGenerator.GenerateKeyBetween(null, key1); // first one

About

Library for generating short string keys for keeping objects in lists in order

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages