We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60a476f commit f4f5906Copy full SHA for f4f5906
1 file changed
packages/delegation-core/src/utils.ts
@@ -1,3 +1,16 @@
1
+/**
2
+ * Converts a numeric value to a hexadecimal string with zero-padding, without 0x prefix.
3
+ *
4
+ * @param options - The options for the conversion.
5
+ * @param options.value - The numeric value to convert to hex (bigint or number).
6
+ * @param options.size - The size in bytes for the resulting hex string (each byte = 2 hex characters).
7
+ * @returns A hexadecimal string prefixed with zeros to match the specified size.
8
+ * @example
9
+ * ```typescript
10
+ * toHexString({ value: 255, size: 2 }) // Returns "00ff"
11
+ * toHexString({ value: 16n, size: 1 }) // Returns "10"
12
+ * ```
13
+ */
14
export const toHexString = ({
15
value,
16
size,
0 commit comments