Skip to content

Create a ranking from integer or / and floats in JavaScript

Notifications You must be signed in to change notification settings

Antoinebr/rank-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Create a ranking from integer or / and floats in JavaScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published