1.0.0 • Published 3 years ago

@njam-data/diversity-index v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

@njam-data/diversity-index

Based on the USA Today diversity index.

Install

npm i @njam-data/diversity-index

Examples

creating an index from one factor

const race = [0.7, 0.3]
const result = diversityIndex([
  race
])
console.log('result', result)
// result === 0.42

creating an index from two factors

const race = [0.3, 0.2, 0.1, 0.5]
const ethnicity = [0.1, 0.9]
const result = diversityIndex([
  race,
  ethnicity
])
console.log('result', result)
// result === 0.75

See also

1.0.0

3 years ago

0.0.0

3 years ago