An open API service indexing awesome lists of open source software.

https://github.com/ericvera/sort-value

A JavaScript utility library to generate sort values (floating point)
https://github.com/ericvera/sort-value

Last synced: 10 months ago
JSON representation

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

Awesome Lists containing this project

README

          

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





# Usage

Install the module:

```sh
npm install sort-value --save
```

```js
sortValue(after, before);
```
Returns a value between the after and before.

```js
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](https://github.com/ericvera/sort-value/blob/master/LICENSE)