@xylabs/hex 4.13.15 → 4.13.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -35
- package/dist/neutral/index.d.ts +5 -78
- package/dist/neutral/spec/address.spec.d.ts +2 -0
- package/dist/neutral/spec/address.spec.d.ts.map +1 -0
- package/dist/neutral/spec/hash.spec.d.ts +2 -0
- package/dist/neutral/spec/hash.spec.d.ts.map +1 -0
- package/dist/neutral/spec/hex.spec.d.ts +2 -0
- package/dist/neutral/spec/hex.spec.d.ts.map +1 -0
- package/package.json +5 -5
- package/build/neutral/index.d.ts +0 -5
- /package/{build → dist}/neutral/address.d.ts +0 -0
- /package/{build → dist}/neutral/address.d.ts.map +0 -0
- /package/{build → dist}/neutral/assert.d.ts +0 -0
- /package/{build → dist}/neutral/assert.d.ts.map +0 -0
- /package/{build → dist}/neutral/hash.d.ts +0 -0
- /package/{build → dist}/neutral/hash.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/as.d.ts +0 -0
- /package/{build → dist}/neutral/hex/as.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/from/from.d.ts +0 -0
- /package/{build → dist}/neutral/hex/from/from.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/from/fromArrayBuffer.d.ts +0 -0
- /package/{build → dist}/neutral/hex/from/fromArrayBuffer.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/from/fromBigInt.d.ts +0 -0
- /package/{build → dist}/neutral/hex/from/fromBigInt.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/from/fromHexString.d.ts +0 -0
- /package/{build → dist}/neutral/hex/from/fromHexString.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/from/fromNumber.d.ts +0 -0
- /package/{build → dist}/neutral/hex/from/fromNumber.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/from/index.d.ts +0 -0
- /package/{build → dist}/neutral/hex/from/index.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/index.d.ts +0 -0
- /package/{build → dist}/neutral/hex/index.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/is.d.ts +0 -0
- /package/{build → dist}/neutral/hex/is.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/isHexZero.d.ts +0 -0
- /package/{build → dist}/neutral/hex/isHexZero.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/legacy.d.ts +0 -0
- /package/{build → dist}/neutral/hex/legacy.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/model.d.ts +0 -0
- /package/{build → dist}/neutral/hex/model.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/nibble.d.ts +0 -0
- /package/{build → dist}/neutral/hex/nibble.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/regex.d.ts +0 -0
- /package/{build → dist}/neutral/hex/regex.d.ts.map +0 -0
- /package/{build → dist}/neutral/hex/to.d.ts +0 -0
- /package/{build → dist}/neutral/hex/to.d.ts.map +0 -0
- /package/{build → dist}/neutral/hexToBigInt.d.ts +0 -0
- /package/{build → dist}/neutral/hexToBigInt.d.ts.map +0 -0
- /package/{build → dist}/neutral/index.d.ts.map +0 -0
package/README.md
CHANGED
|
@@ -1,67 +1,54 @@
|
|
|
1
|
-
[![logo][]](https://xylabs.com)
|
|
2
|
-
|
|
3
1
|
# @xylabs/hex
|
|
4
2
|
|
|
3
|
+
[![logo][]](https://xylabs.com)
|
|
4
|
+
|
|
5
|
+
[![main-build][]][main-build-link]
|
|
5
6
|
[![npm-badge][]][npm-link]
|
|
6
7
|
[![npm-downloads-badge][]][npm-link]
|
|
7
8
|
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
9
|
[![npm-license-badge][]](LICENSE)
|
|
10
|
+
[![codacy-badge][]][codacy-link]
|
|
11
|
+
[![codeclimate-badge][]][codeclimate-link]
|
|
12
|
+
[![snyk-badge][]][snyk-link]
|
|
9
13
|
[![socket-badge][]][socket-link]
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Table of Contents
|
|
14
|
-
|
|
15
|
-
- [Description](#description)
|
|
16
|
-
- [Install](#install)
|
|
17
|
-
- [Maintainers](#maintainers)
|
|
18
|
-
- [License](#license)
|
|
19
|
-
- [Credits](#credits)
|
|
20
|
-
|
|
21
|
-
## Description
|
|
22
|
-
|
|
23
|
-
Various Hex helper functions for conversion and formatting
|
|
15
|
+
Version: 4.13.15
|
|
24
16
|
|
|
25
|
-
|
|
17
|
+
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## Install
|
|
30
|
-
|
|
31
|
-
Using npm:
|
|
32
|
-
|
|
33
|
-
```sh
|
|
34
|
-
npm i --save @xylabs/hex
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Using yarn:
|
|
19
|
+
## Documentation
|
|
38
20
|
|
|
39
|
-
|
|
40
|
-
yarn add @xylabs/hex
|
|
41
|
-
```
|
|
21
|
+
Coming Soon!
|
|
42
22
|
|
|
43
|
-
|
|
44
|
-
[Developer Reference](https://xylabs.github.io/sdk-js)
|
|
23
|
+
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
45
24
|
|
|
46
25
|
## Maintainers
|
|
47
26
|
|
|
48
27
|
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
49
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
50
28
|
- [Matt Jones](https://github.com/jonesmac)
|
|
29
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
51
30
|
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
52
31
|
|
|
53
32
|
## License
|
|
54
33
|
|
|
55
|
-
See the [LICENSE](LICENSE) file for license details
|
|
34
|
+
> See the [LICENSE](LICENSE) file for license details
|
|
56
35
|
|
|
57
36
|
## Credits
|
|
58
37
|
|
|
59
|
-
[Made with 🔥and ❄️ by
|
|
38
|
+
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
|
|
60
39
|
|
|
61
40
|
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
62
41
|
|
|
42
|
+
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
|
|
43
|
+
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
|
|
63
44
|
[npm-badge]: https://img.shields.io/npm/v/@xylabs/hex.svg
|
|
64
45
|
[npm-link]: https://www.npmjs.com/package/@xylabs/hex
|
|
46
|
+
[codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
|
|
47
|
+
[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
|
|
48
|
+
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
49
|
+
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
50
|
+
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
51
|
+
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
65
52
|
|
|
66
53
|
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/hex
|
|
67
54
|
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/hex
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,78 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
interface HexConfig {
|
|
7
|
-
bitLength?: number;
|
|
8
|
-
byteSize?: number;
|
|
9
|
-
prefix?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
declare function asHex(value: unknown): Hex | undefined;
|
|
13
|
-
declare function asHex(value: unknown, assert: AssertConfig): Hex;
|
|
14
|
-
|
|
15
|
-
/** Takes unknown value and tries our best to convert it to a hex string */
|
|
16
|
-
declare const hexFrom: (
|
|
17
|
-
/** Supported types are string, number, bigint, and ArrayBuffer */
|
|
18
|
-
value: string | number | bigint | ArrayBufferLike,
|
|
19
|
-
/** Configuration of output format and validation */
|
|
20
|
-
config?: HexConfig) => Hex;
|
|
21
|
-
|
|
22
|
-
/** Convert an ArrayBuffer to a hex string */
|
|
23
|
-
declare const hexFromArrayBuffer: (
|
|
24
|
-
/** The buffer to be converted */
|
|
25
|
-
buffer: ArrayBufferLike,
|
|
26
|
-
/** Configuration of output format and validation */
|
|
27
|
-
config?: HexConfig) => Hex;
|
|
28
|
-
|
|
29
|
-
/** Convert a bigint to a hex string */
|
|
30
|
-
declare const hexFromBigInt: (
|
|
31
|
-
/** The bigint to be converted */
|
|
32
|
-
value: bigint,
|
|
33
|
-
/** Configuration of output format and validation */
|
|
34
|
-
config?: HexConfig) => Hex;
|
|
35
|
-
|
|
36
|
-
declare const hexFromHexString: (value: string, config?: HexConfig) => Hex;
|
|
37
|
-
|
|
38
|
-
declare const hexFromNumber: (value: number, config?: HexConfig) => Hex;
|
|
39
|
-
|
|
40
|
-
declare const isHex: (value: unknown, config?: HexConfig) => value is Hex;
|
|
41
|
-
|
|
42
|
-
declare const isHexZero: (value?: string) => boolean | undefined;
|
|
43
|
-
|
|
44
|
-
declare const toHexLegacy: (buffer: ArrayBuffer) => string;
|
|
45
|
-
|
|
46
|
-
declare const bitsToNibbles: (value: number) => number;
|
|
47
|
-
declare const nibblesToBits: (value: number) => number;
|
|
48
|
-
|
|
49
|
-
declare const hexRegex: RegExp;
|
|
50
|
-
declare const hexRegexWithPrefix: RegExp;
|
|
51
|
-
|
|
52
|
-
/** takes any value and tries our best to convert it to a hex string */
|
|
53
|
-
declare const toHex: (
|
|
54
|
-
/** Supported types are string, number, bigint, and ArrayBuffer */
|
|
55
|
-
value: string | number | bigint | ArrayBufferLike,
|
|
56
|
-
/** Configuration of output format and validation */
|
|
57
|
-
config?: HexConfig) => Lowercase<string>;
|
|
58
|
-
|
|
59
|
-
type Address = Exclude<Hex, 'reserved-address-value'>;
|
|
60
|
-
declare const ZERO_ADDRESS: Address;
|
|
61
|
-
declare const toAddress: (value: string | number | bigint | ArrayBufferLike, config?: HexConfig) => Lowercase<string>;
|
|
62
|
-
declare const isAddress: (value: unknown, config?: HexConfig) => value is Address;
|
|
63
|
-
declare function asAddress(value: unknown): Address | undefined;
|
|
64
|
-
declare function asAddress(value: unknown, assert: AssertConfig): Address;
|
|
65
|
-
|
|
66
|
-
declare const ZERO_HASH: Hash;
|
|
67
|
-
type HashBitLength = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
|
|
68
|
-
declare const HashBitLength: HashBitLength[];
|
|
69
|
-
declare const isHashBitLength: (value: unknown) => value is HashBitLength;
|
|
70
|
-
type Hash = Exclude<Hex, 'reserved-hash-value'>;
|
|
71
|
-
declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Hash;
|
|
72
|
-
declare function asHash(value: unknown): Hash | undefined;
|
|
73
|
-
declare function asHash(value: unknown, assert: AssertConfig): Hash;
|
|
74
|
-
|
|
75
|
-
declare function hexToBigInt(hex: Hex): bigint;
|
|
76
|
-
|
|
77
|
-
export { HashBitLength, ZERO_ADDRESS, ZERO_HASH, asAddress, asHash, asHex, bitsToNibbles, hexFrom, hexFromArrayBuffer, hexFromBigInt, hexFromHexString, hexFromNumber, hexRegex, hexRegexWithPrefix, hexToBigInt, isAddress, isHash, isHashBitLength, isHex, isHexZero, nibblesToBits, toAddress, toHex, toHexLegacy };
|
|
78
|
-
export type { Address, Hash, Hex, HexConfig };
|
|
1
|
+
export * from './address.ts';
|
|
2
|
+
export * from './hash.ts';
|
|
3
|
+
export * from './hex/index.ts';
|
|
4
|
+
export * from './hexToBigInt.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/address.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/hash.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hex.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/hex.spec.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/hex",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.17",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hex",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"packages/**/*"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@xylabs/typeof": "^4.13.
|
|
42
|
+
"@xylabs/typeof": "^4.13.17"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.
|
|
46
|
-
"@xylabs/tsconfig": "^7.0.0-rc.
|
|
47
|
-
"@xylabs/vitest-extended": "^4.13.
|
|
45
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
|
|
46
|
+
"@xylabs/tsconfig": "^7.0.0-rc.27",
|
|
47
|
+
"@xylabs/vitest-extended": "^4.13.17",
|
|
48
48
|
"typescript": "^5.8.3",
|
|
49
49
|
"vitest": "^3.2.4"
|
|
50
50
|
},
|
package/build/neutral/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|