Node Usage
Install
Section titled “Install”npm install @peterbenoit/mathsjsImport in CommonJS
Section titled “Import in CommonJS”const Maths = require('@peterbenoit/mathsjs');
const stats = { sum: Maths.sum(1, 2, 3, 4), median: Maths.median(9, 2, 7, 4), gcd: Maths.gcd(48, 18)};
console.log(stats);Error handling example
Section titled “Error handling example”try { Maths.factorial(-1);} catch (error) { console.error(error.message);}