UNPKG

als-statistics

Version:

Modular JS statistics toolkit for Node.js and the browser: descriptive stats, correlations (Pearson/Spearman/Kendall), t-tests & ANOVA (Student/Welch), reliability (Cronbach’s alpha), regression (linear/logistic), clustering (DBSCAN/HDBSCAN), and table/co

27 lines (25 loc) 1.05 kB
import { pack } from 'als-pack' import { removeComments } from 'als-pack/lib/utils.js' import { writeFileSync } from 'fs' pack('./lib/index.js').then(p => { p.build() const { orderByName, modules } = p let content = orderByName.map(name => { let { imported, exported, source } = modules[name] imported.forEach(({ importString }) => { source = source.replace(importString, '') }); exported.forEach(({ exportString, declaration }) => { if (declaration !== undefined) { source = source.replace(exportString, exportString.replace(/export (default)?/, '')) } else source = source.replace(exportString, '') }); return source }) content = removeComments(content.join('\n')).replace(/^;$/gm, '').replace(/^\s*$/gm, '') content = `const Statistics = (function(){ ${content} return Statistics })()` writeFileSync('./statistics.js', content, 'utf-8') writeFileSync('./statistics.cjs', content+'\n module.exports = Statistics', 'utf-8') })