1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.numberToHex = numberToHex;
|
7 |
|
8 | var _fixLength = require("../hex/fixLength");
|
9 |
|
10 | var _null = require("../is/null");
|
11 |
|
12 | var _undefined = require("../is/undefined");
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | function numberToHex(value) {
|
33 | let bitLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
|
34 |
|
35 | if ((0, _undefined.isUndefined)(value) || (0, _null.isNull)(value) || isNaN(value)) {
|
36 | return '0x';
|
37 | }
|
38 |
|
39 | const hex = value.toString(16);
|
40 | return (0, _fixLength.hexFixLength)(hex.length % 2 ? `0${hex}` : hex, bitLength, true);
|
41 | } |
\ | No newline at end of file |