1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.hexStripPrefix = void 0;
|
4 | const hex_js_1 = require("../is/hex.js");
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 | function hexStripPrefix(value) {
|
20 | if (!value || value === '0x') {
|
21 | return '';
|
22 | }
|
23 | else if (hex_js_1.REGEX_HEX_PREFIXED.test(value)) {
|
24 | return value.substring(2);
|
25 | }
|
26 | else if (hex_js_1.REGEX_HEX_NOPREFIX.test(value)) {
|
27 | return value;
|
28 | }
|
29 | throw new Error(`Expected hex value to convert, found '${value}'`);
|
30 | }
|
31 | exports.hexStripPrefix = hexStripPrefix;
|