A JavaScript utility library to generate sort values (floating point).
Install the module:
npm install sort-value --save
sortValue(after, before);
Returns a value between the after and before.
import sortValue from 'sort-value';
const value = sortValue(0, 1);
console.log(value);
// Output: 0.5
- undefined, 0 => -1
- 0, undefined => 1
- 0, 1 => 0.5
- 0, 0.5 => 0.3
- 0, 0.1 => 0.05