diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-07-05 23:34:03 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-07-05 23:34:03 +0200 |
| commit | 2df937df1372359babd123d1361e702a1a4b8168 (patch) | |
| tree | a44f4e3e51469c173127ce8660e39c20aa5309d7 /src/lib/math.js | |
| parent | 3717f7fbf9ec110b51fe002cdced5d73ebd6136b (diff) | |
Create the sensor, move values to config
Diffstat (limited to 'src/lib/math.js')
| -rw-r--r-- | src/lib/math.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lib/math.js b/src/lib/math.js new file mode 100644 index 0000000..c745cdc --- /dev/null +++ b/src/lib/math.js @@ -0,0 +1,8 @@ +/** + * Modulo that acts well with negative numbers. + * @param {number} dividend the number to divide + * @param {number} divisor the divisor to calculate the remainder + */ +export const modulo = function modulo (dividend, divisor) { + return ((dividend % divisor) + divisor) % divisor +}; |