mirror of
https://github.com/pezkuwichain/pezkuwi-common.git
synced 2026-04-29 17:17:56 +00:00
chore: update to version 14.0.11 and align website URLs
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { hexToBn } from './toBn.js';
|
||||
/**
|
||||
* @name hexToNumber
|
||||
* @summary Creates a Number value from a Buffer object.
|
||||
* @description
|
||||
* `null` inputs returns an NaN result, `hex` values return the actual value as a `Number`.
|
||||
* @example
|
||||
* <BR>
|
||||
*
|
||||
* ```javascript
|
||||
* import { hexToNumber } from '@pezkuwi/util';
|
||||
*
|
||||
* hexToNumber('0x1234'); // => 0x1234
|
||||
* ```
|
||||
*/
|
||||
export function hexToNumber(value) {
|
||||
return value
|
||||
? hexToBn(value).toNumber()
|
||||
: NaN;
|
||||
}
|
||||
Reference in New Issue
Block a user