MCPcopy
hub / github.com/di-sukharev/opencommit / createLongLongConversion

Function createLongLongConversion

out/cli.cjs:2439–2472  ·  view source on GitHub ↗
(bitLength, { unsigned })

Source from the content-addressed store, hash-verified

2437 };
2438 }
2439 function createLongLongConversion(bitLength, { unsigned }) {
2440 const upperBound = Number.MAX_SAFE_INTEGER;
2441 const lowerBound = unsigned ? 0 : Number.MIN_SAFE_INTEGER;
2442 const asBigIntN = unsigned ? BigInt.asUintN : BigInt.asIntN;
2443 return (value, options = {}) => {
2444 let x5 = toNumber(value, options);
2445 x5 = censorNegativeZero(x5);
2446 if (options.enforceRange) {
2447 if (!Number.isFinite(x5)) {
2448 throw makeException(TypeError, "is not a finite number", options);
2449 }
2450 x5 = integerPart(x5);
2451 if (x5 < lowerBound || x5 > upperBound) {
2452 throw makeException(
2453 TypeError,
2454 `is outside the accepted range of ${lowerBound} to ${upperBound}, inclusive`,
2455 options
2456 );
2457 }
2458 return x5;
2459 }
2460 if (!Number.isNaN(x5) && options.clamp) {
2461 x5 = Math.min(Math.max(x5, lowerBound), upperBound);
2462 x5 = evenRound(x5);
2463 return x5;
2464 }
2465 if (!Number.isFinite(x5) || x5 === 0) {
2466 return 0;
2467 }
2468 let xBigInt = BigInt(integerPart(x5));
2469 xBigInt = asBigIntN(bitLength, xBigInt);
2470 return Number(xBigInt);
2471 };
2472 }
2473 exports2.any = (value) => {
2474 return value;
2475 };

Calls 8

toNumberFunction · 0.85
censorNegativeZeroFunction · 0.85
makeExceptionFunction · 0.85
integerPartFunction · 0.85
evenRoundFunction · 0.85
isFiniteMethod · 0.80
minMethod · 0.45
maxMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…