Skip to content
25 linesCodeBlameRaw

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Add math helpers, tests and checks1const assert = require("node:assert");
2const math = require("./math");
Merge main into mod branch, keeping subtract and mod3assert.strictEqual(math.subtract(5, 3), 2);
Add math helpers, tests and checks4
5assert.strictEqual(math.add(2, 3), 5);
Merge #3: Add multiply to math.js6assert.strictEqual(math.multiply(4, 5), 20);
Add mod function to math.js7assert.strictEqual(math.mod(7, 3), 1);
8assert.strictEqual(math.mod(-1, 3), 2);
9assert.strictEqual(math.mod(6, 3), 0);
10assert.strictEqual(math.mod(-1, -3), 2);
11assert.throws(() => math.mod(1, 0), RangeError);
Catch up with main12assert.strictEqual(math.power(2, 10), 1024);
13assert.strictEqual(math.power(5, 0), 1);
14assert.throws(() => math.power(2, -1), RangeError);
Merge main into mod branch, keeping subtract and mod15assert.strictEqual(math.mean([1, 2, 3]), 2);
Catch up with main16assert.strictEqual(math.mean([1, 2, 3, 4]), 2.5);
Merge main into mod branch, keeping subtract and mod17assert.strictEqual(math.median([1, 2, 3]), 2);
Catch up with main18assert.strictEqual(math.median([3, 1, 2]), 2);
19assert.strictEqual(math.median([4, 1, 3, 2]), 2.5);
Merge main into mod branch, keeping subtract and mod20assert.strictEqual(math.standard_deviation([1, 2, 3]), Math.sqrt(2 / 3));
Catch up with main21assert.strictEqual(math.standard_deviation([2, 4, 4, 4, 5, 5, 7, 9]), 2);
22for (const fn of [math.mean, math.median, math.standard_deviation]) {
23 assert.throws(() => fn([]), TypeError);
24}
Add math helpers, tests and checks25console.log("all tests passed");

This file's history is long; its oldest lines are credited to the oldest commit read.