*/\r
static toArray (hex: string, padding: number = 0): number[] {\r
if (typeof hex !== 'string' || !/^[A-Fa-f0-9]+$/i.test(hex)) {\r
- throw new TypeError('Invalid string when converting hex to array')\r
+ throw new TypeError('Invalid string when converting hex to array', { cause: hex })\r
}\r
if (typeof padding !== 'number') {\r
- throw new TypeError('Invalid padding when converting hex to array')\r
+ throw new TypeError('Invalid padding when converting hex to array', { cause: padding })\r
}\r
if (hex.length % 2 === 1) hex = `0${hex}`\r
const hexArray = hex.match(/.{2}/g)\r
if (hexArray == null) {\r
- throw new RangeError('Invalid hex string when converting to array')\r
+ throw new RangeError('Invalid hex string when converting to array', { cause: hexArray })\r
}\r
for (let i = hexArray.length; i < padding; i++) {\r
hexArray.unshift('0')\r
}
//@ts-expect-error
BROWSER: postMessage(data, buffers)
- NODE: parentPort?.postMessage({ data }, buffers)
+ NODE: parentPort?.postMessage(data, buffers)
}
/**