Adjust exports (#1585)

This commit is contained in:
Jaco
2022-07-07 08:31:58 +03:00
committed by GitHub
parent 3828d941a9
commit 4bb2c83213
3 changed files with 3 additions and 9 deletions
+1 -3
View File
@@ -22,7 +22,7 @@ const DEFAULT_OPTS: NumberOptions = { bitLength: -1, isLe: true, isNegative: fal
* bnToU8a(new BN(0x1234)); // => [0x12, 0x34]
* ```
*/
function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, { bitLength = -1, isLe = true, isNegative = false } = DEFAULT_OPTS): Uint8Array {
export function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number | null, { bitLength = -1, isLe = true, isNegative = false } = DEFAULT_OPTS): Uint8Array {
const valueBn = bnToBn(value);
const byteLength = bitLength === -1
? Math.ceil(valueBn.bitLength() / 8)
@@ -43,5 +43,3 @@ function bnToU8a <ExtToBn extends ToBn> (value?: ExtToBn | BN | bigint | number
return output;
}
export { bnToU8a };
+1 -3
View File
@@ -24,7 +24,7 @@ import { hexStripPrefix } from './stripPrefix';
* hexToBn('0x123480001f'); // => BN(0x123480001f)
* ```
*/
function hexToBn (value?: string | null, { isLe = false, isNegative = false }: ToBnOptions = {}): BN {
export function hexToBn (value?: string | null, { isLe = false, isNegative = false }: ToBnOptions = {}): BN {
if (!value || value === '0x') {
return new BN(0);
}
@@ -38,5 +38,3 @@ function hexToBn (value?: string | null, { isLe = false, isNegative = false }: T
? bn.fromTwos(stripped.length * 4)
: bn;
}
export { hexToBn };
+1 -3
View File
@@ -23,7 +23,7 @@ import { BN } from '../bn/bn';
* u8aToHex(new Uint8Array([0x68, 0x65, 0x6c, 0x6c, 0xf])); // 0x68656c0f
* ```
*/
function u8aToBn (value: Uint8Array, { isLe = true, isNegative = false }: ToBnOptions = {}): BN {
export function u8aToBn (value: Uint8Array, { isLe = true, isNegative = false }: ToBnOptions = {}): BN {
const count = value.length;
// shortcut for <= u48 values - in this case the manual conversion
@@ -120,5 +120,3 @@ function u8aToBn (value: Uint8Array, { isLe = true, isNegative = false }: ToBnOp
? new BN(value, isLe ? 'le' : 'be').fromTwos(value.length * 8)
: new BN(value, isLe ? 'le' : 'be');
}
export { u8aToBn };