mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-22 05:59:31 +08:00
- Enforce oxlint and oxfmt for owned JavaScript and TypeScript with independent CI checks. - Preserve compiler import boundaries and protected fixtures while cleaning up lint findings. - Standardize source formatting and validate import, fixture, and embedded-source protections.
14 lines
533 B
TypeScript
14 lines
533 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;
|
|
}
|