1.0.3 • Published 3 years ago

majority v1.0.3

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

majority

total downloads of majority majority's License latest version of majority

A two-bit library to get the most popular value.

(new Majority(1, 1, 2, 2, 2, 3, 3)).value()
// 2

const majority = new Majority()

console.log(majority.value('foo'))
// foo

for (let i = 0; i < 5; ++i) majority.feed('Trump')

console.log(majority.value())
// Trump

for (let i = 0; i < 10; ++i) majority.feed('Biden')

for (let i = 0; i < 6; ++i) majority.feed('Hilary')

console.log(majority.value())
// Biden
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago