chore: update to version 14.0.11 and align website URLs

This commit is contained in:
2026-01-11 11:34:13 +03:00
parent ef74383349
commit 19c8d69bd8
1499 changed files with 53633 additions and 89 deletions
+22
View File
@@ -0,0 +1,22 @@
/**
* @name u8aToHex
* @summary Creates a hex string from a Uint8Array object.
* @description
* `UInt8Array` input values return the actual hex string. `null` or `undefined` values returns an `0x` string.
* @example
* <BR>
*
* ```javascript
* import { u8aToHex } from '@pezkuwi/util';
*
* u8aToHex(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0xf])); // 0x68656c0f
* ```
*/
export function u8aToHex(value, bitLength = -1, isPrefixed = true) {
const length = Math.ceil(bitLength / 8);
return `${isPrefixed ? '0x' : ''}${!value?.length
? ''
: (bitLength > 0 && value.length > length)
? `${Buffer.from(value.subarray(0, length / 2)).toString('hex')}${Buffer.from(value.subarray(value.length - length / 2)).toString('hex')}`
: Buffer.from(value).toString('hex')}`;
}