Skip to content
20 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 checks1// Small helpers for numbers.
Merge #3: Add multiply to math.js2/** Returns the sum of a and b. */
Add math helpers, tests and checks3function add(a, b) {
4 return a + b;
5}
6
Merge #3: Add multiply to math.js7/** Returns the product of a and b. */
8function multiply(a, b) {
9 return a * b;
10}
11
Add mod function to math.js12/** Returns the non-negative remainder of a divided by b; throws RangeError when b is 0. */
13function mod(a, b) {
14 if (b === 0) {
15 throw new RangeError("mod by zero");
16 }
17 return ((a % b) + Math.abs(b)) % Math.abs(b);
18}
19
20module.exports = { add, multiply, mod };

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