Skip to content

ericvera/sort-value

Repository files navigation

sort-value

A JavaScript utility library to generate sort values (floating point).

Usage

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

Input => Output

  • undefined, 0 => -1
  • 0, undefined => 1
  • 0, 1 => 0.5
  • 0, 0.5 => 0.3
  • 0, 0.1 => 0.05

License

MIT

About

A JavaScript utility library to generate sort values (floating point)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published