mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-23 06:10:02 +08:00
- Complete frontend lowering with zero rejected statements, dynamic islands, or skipped functions. - Support contextual construction, presence guards, and union record copies used by the compiler. - Add native CommonJS resolution and cross-platform file URL handling while preserving Node host behavior.
13 lines
529 B
TypeScript
13 lines
529 B
TypeScript
/** Exact integer spelling shared by frontend inspection and code emission.
|
|
* Division preserves all safe integer bits without general radix conversion. */
|
|
export function unsignedHex(value: number): string {
|
|
if (!Number.isSafeInteger(value) || value < 0) throw new RangeError("hexadecimal value must be a nonnegative safe integer");
|
|
const digits = "0123456789abcdef";
|
|
let result = "";
|
|
do {
|
|
result = digits.charAt(value % 16) + result;
|
|
value = Math.floor(value / 16);
|
|
} while (value !== 0);
|
|
return result;
|
|
}
|