MCPcopy
hub / github.com/bbc/peaks.js / roundUpToNearest

Function roundUpToNearest

src/utils.js:61–76  ·  view source on GitHub ↗
(value, multiple)

Source from the content-addressed store, hash-verified

59 */
60
61export function roundUpToNearest(value, multiple) {
62 if (multiple === 0) {
63 return 0;
64 }
65
66 let multiplier = 1;
67
68 if (value < 0.0) {
69 multiplier = -1;
70 value = -value;
71 }
72
73 const roundedUp = Math.ceil(value);
74
75 return multiplier * (((roundedUp + multiple - 1) / multiple) | 0) * multiple;
76}
77
78export function clamp(value, min, max) {
79 if (value < min) {

Callers 2

utils-spec.jsFile · 0.90
waveform-axis.jsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected