1.0.1 • Published 5 years ago

rank-numbers v1.0.1

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

RankNumbers

Create a ranking from an array. It will sort an array, remove duplicates handle when values are equal in the array...

How to use

Install the module

npm install rank-numbers

Require the module :

const {createRanking,getRank} = require('rank-numbers');

Create a overall ranking first :

const myRanking = createRanking([1, 9, 10, 9, 7, 1, 1];
// myRanking === {"1": 4,"7": 3,"9": 2,"10": 1}

Get the ranking for a specific value in a secondtime :

const theRanking = getRank(10,myRanking);
// theRanking === 1

run the tests

npm run test
1.0.1

5 years ago

1.0.0

5 years ago