MCPcopy Index your code
hub / github.com/nodejs/node / modulo

Function modulo

lib/internal/webidl.js:230–237  ·  view source on GitHub ↗

* Returns x modulo y for Web IDL ConvertToInt step 10. * * This is intentionally not a general modulo helper. ConvertToInt only calls * it with a positive power-of-two modulus, and the implementation assumes * that. It converts JavaScript remainder into mathematical modulo and * normalizes -0 t

(x, y)

Source from the content-addressed store, hash-verified

228 * @returns {number}
229 */
230function modulo(x, y) {
231 // Web IDL ConvertToInt step 10 uses mathematical modulo.
232 const r = x % y;
233 if (r === 0) {
234 return 0;
235 }
236 return r > 0 ? r : r + y;
237}
238
239/**
240 * Returns x modulo y for Web IDL ConvertToInt step 10.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…