stable-position

1.0.0 • Public • Published

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(< 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

/stable-position/

    Package Sidebar

    Install

    npm i stable-position

    Weekly Downloads

    3

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    5.54 kB

    Total Files

    6

    Last publish

    Collaborators

    • pirxpilot