UNPKG

als-statistics

Version:

A powerful and lightweight JavaScript library for descriptive statistics, regression, clustering, outlier detection, and noise analysis using a flexible table/column architecture.

15 lines (14 loc) 329 B
function compute(fn, { n, columns }) { const values = []; let j = 0; for (let i = 0; i < n; i++) { const obj = {} for (let colName in columns) { obj[colName] = columns[colName]._values[i] } values.push(fn(obj, j)) j++ } return values } module.exports = compute