Skip to content
/ ranks Public

Map an array of numbers into their fractional ranks

Notifications You must be signed in to change notification settings

dsernst/ranks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ranks

NPM Version Build Status Coverage Status

Map an array of numbers into their fractional ranks

Usage

rank([1, 8, 5, 3, 12, 10]) // [1, 4, 3, 2, 6, 5]

Use the fractional mean in the case of ties:

rank([1, 1, 1, 2]) // [2, 2, 2, 4]
rank([1, 1, 1, 1]) // [2.5, 2.5, 2.5, 2.5]

Tests

Run the unit tests with npm test:

> ava tests.js


  ✔ rank should map arrays to their ranks
  ✔ rank should resolve ties at the mean

  2 tests passed

About

Map an array of numbers into their fractional ranks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published