summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/helpers/iso/isoUint8Array.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2023-08-22 10:13:03 -0700
committerGitHub <noreply@github.com>2023-08-22 10:13:03 -0700
commitfefc95e4535e6ecf903f647124a492fba3fd11d6 (patch)
tree4c924d43d32fb12a780533302eaf5dee08875d75 /packages/server/src/helpers/iso/isoUint8Array.ts
parent443c341bc2163f07b93a3ef84a43294d10b826f8 (diff)
parent2935857c76d458c26701842e500f8d97d17499c5 (diff)
Merge pull request #425 from MasterKale/feat/server-esm-take-2-dnt
feat/server-esm-take-2-dnt
Diffstat (limited to 'packages/server/src/helpers/iso/isoUint8Array.ts')
-rw-r--r--packages/server/src/helpers/iso/isoUint8Array.ts11
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/server/src/helpers/iso/isoUint8Array.ts b/packages/server/src/helpers/iso/isoUint8Array.ts
index 7dc163e..0df6763 100644
--- a/packages/server/src/helpers/iso/isoUint8Array.ts
+++ b/packages/server/src/helpers/iso/isoUint8Array.ts
@@ -15,7 +15,7 @@ export function areEqual(array1: Uint8Array, array2: Uint8Array): boolean {
* A replacement for `Buffer.toString('hex')`
*/
export function toHex(array: Uint8Array): string {
- const hexParts = Array.from(array, i => i.toString(16).padStart(2, '0'));
+ const hexParts = Array.from(array, (i) => i.toString(16).padStart(2, '0'));
// adce000235bcc60a648b0b25f1f05503
return hexParts.join('');
@@ -31,7 +31,8 @@ export function fromHex(hex: string): Uint8Array {
return Uint8Array.from([]);
}
- const isValid = hex.length !== 0 && hex.length % 2 === 0 && !/[^a-fA-F0-9]/u.test(hex);
+ const isValid = hex.length !== 0 && hex.length % 2 === 0 &&
+ !/[^a-fA-F0-9]/u.test(hex);
if (!isValid) {
throw new Error('Invalid hex string');
@@ -39,7 +40,7 @@ export function fromHex(hex: string): Uint8Array {
const byteStrings = hex.match(/.{1,2}/g) ?? [];
- return Uint8Array.from(byteStrings.map(byte => parseInt(byte, 16)));
+ return Uint8Array.from(byteStrings.map((byte) => parseInt(byte, 16)));
}
/**
@@ -51,7 +52,7 @@ export function concat(arrays: Uint8Array[]): Uint8Array {
const toReturn = new Uint8Array(totalLength);
- arrays.forEach(arr => {
+ arrays.forEach((arr) => {
toReturn.set(arr, pointer);
pointer += arr.length;
});
@@ -79,7 +80,7 @@ export function fromUTF8String(utf8String: string): Uint8Array {
* Convert an ASCII string to Uint8Array
*/
export function fromASCIIString(value: string): Uint8Array {
- return Uint8Array.from(value.split('').map(x => x.charCodeAt(0)));
+ return Uint8Array.from(value.split('').map((x) => x.charCodeAt(0)));
}
/**