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

Function integerPart

lib/internal/webidl.js:173–178  ·  view source on GitHub ↗

* Returns IntegerPart(n). * @see https://webidl.spec.whatwg.org/#abstract-opdef-integerpart * @param {number} n Numeric value. * @returns {number}

(n)

Source from the content-addressed store, hash-verified

171 * @returns {number}
172 */
173function integerPart(n) {
174 // Web IDL IntegerPart steps 1-3: floor(abs(n)), restore the sign,
175 // and choose +0 rather than -0.
176 const integer = MathTrunc(n);
177 return integer === 0 ? 0 : integer;
178}
179
180/**
181 * Rounds to the nearest integer, choosing the even integer on ties.

Callers 2

evenRoundFunction · 0.85
convertToIntFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…