stable-position
v1.0.0
Published
Generate unique position that can be used to order items without renumbering them.
Downloads
3
Maintainers
Readme
stable-position
Generate unique position that can be used to order items without renumbering them.
Install
$ npm install --save stable-position
Usage
const { first, after, between } = require('stable-position');
const a = first();
const z = after(a);
const x = between(a, z);
const assert = require('assert');
assert(a < x && x < z);
API
first()
returns a position value that is smaller than any other position
before(p)
returns a position value that is smaller than the position represented by p
after(p)
returns a position value that is bigger than the position represented by p
between(p ,q)
return position value that is between p and q
License
MIT © Damian Krzeminski