1.0.0 • Published 5 years ago

stable-position v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

NPM version Build Status Dependency Status Dev Dependency Status

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