All files / src/utils math.js

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23                                        54x    
/**
* Copyright 2018, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
 
/**
 * @param {Number} number
 * @param {Number} mod
 * @returns {Number} number - number % mod (the number rounded by its modulo
 *
 * Example:
 *
 * 25 % 5 = 25
 * 26 % 5 = 25
 * 31 % 5 = 30
 */
export function roundMod(number, mod) {
  return number - number % mod;
}