}\r
}\r
\r
+export const obj = {\r
+ /**\r
+ * Convert a numerically-indexed object of 8-bit values to a Uint8Array of bytes.\r
+ *\r
+ * @param {object} obj - Object to convert\r
+ * @returns {Uint8Array} Byte array representation of the input object\r
+ */\r
+ toBytes (obj: { [key: number]: number }): Uint8Array {\r
+ const values = Object.keys(obj)\r
+ .map(key => +key)\r
+ .sort((a, b) => a - b)\r
+ .map(i => obj[i])\r
+ return new Uint8Array(values)\r
+ }\r
+}\r
+\r
export default { base32, bin, bytes, dec, hex, utf8 }\r