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) 427 B
function getType(values=[]) { if (!Array.isArray(values)) throw new Error("Input must be an array"); let type = Number; for(let v of values) { if(typeof v === 'number') { if (!Number.isFinite(v) || isNaN(v)) throw new Error("All elements in the array must be finite valid numbers"); continue } type = String break; } return type } module.exports = getType