UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

15 lines (13 loc) 326 B
import { assert } from "../assert.js"; /** * Uint8 to hex (2 characters) * * @example uint82hex(10) => "0A" * @param {number} x * @return {string} */ export function uint82hex(x) { assert.isNonNegativeInteger(x, 'x'); const hex = x.toString(16); return (hex.length === 1) ? "0" + hex : hex; }