mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-29 16:07:58 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.nToBigInt = nToBigInt;
|
||||
const x_bigint_1 = require("@pezkuwi/x-bigint");
|
||||
const toBigInt_js_1 = require("../hex/toBigInt.js");
|
||||
const bn_js_1 = require("../is/bn.js");
|
||||
const hex_js_1 = require("../is/hex.js");
|
||||
const toBigInt_js_2 = require("../is/toBigInt.js");
|
||||
const toBn_js_1 = require("../is/toBn.js");
|
||||
/**
|
||||
* @name nToBigInt
|
||||
* @summary Creates a bigInt value from a BN, bigint, string (base 10 or hex) or number input.
|
||||
*/
|
||||
function nToBigInt(value) {
|
||||
return typeof value === 'bigint'
|
||||
? value
|
||||
: !value
|
||||
? (0, x_bigint_1.BigInt)(0)
|
||||
: (0, hex_js_1.isHex)(value)
|
||||
? (0, toBigInt_js_1.hexToBigInt)(value.toString())
|
||||
: (0, bn_js_1.isBn)(value)
|
||||
? (0, x_bigint_1.BigInt)(value.toString())
|
||||
: (0, toBigInt_js_2.isToBigInt)(value)
|
||||
? value.toBigInt()
|
||||
: (0, toBn_js_1.isToBn)(value)
|
||||
? (0, x_bigint_1.BigInt)(value.toBn().toString())
|
||||
: (0, x_bigint_1.BigInt)(value);
|
||||
}
|
||||
Reference in New Issue
Block a user