Skip to content

sahmmie/rankerjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rankerjs

A light weight NPM module to rank data.

Installation

Use the package manager npm to install rankerjs.

npm i rankerjs

Usage

const ranker = require('rankerjs');

returns []
ranker({ useTestData: true })

returns [ 
  { name: 'test-1', rating: 100, rank: 1 },
  { name: 'test-2', rating: 50, rank: 2, tie: true },
  { name: 'test-3', rating: 50, rank: 2, tie: true }
  ]
const testData = [
        { name: 'test-1', rating: 100 },
        { name: 'test-2', rating: 50 },
        { name: 'test-3', rating: 50 },
      ];
ranker({ data: testData, key: 'rating' });

//Additional fields:
//rank:number, tie: boolean

Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License
[MIT](https://choosealicense.com/licenses/mit/)

About

A light weight NPM module to rank data.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors