1.0.1 • Published 6 years ago

online-max v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

online-max

Find maximum processing values one by one (online algorithm)

Usage

const Max = require('online-max')
const max = Max()

// Direct call
const max1 = Max()
;[1,2,3,4,5].forEach(v => { max1(v) })
console.log(max1()) // -> 5

// Or via .fit() and .value getter
const max2 = Max()
;[1,2,3,4,5].forEach(v => { max2.fit(v) })
console.log(max2.value) // -> 5

// You can also pass arays to max
max2([3.2, 2, 4])
// Keep in mind - we already declared max2, so we just update it
// Maximum is still 5
console.log(max2.value) // -> 5!