@xylabs/hex 4.0.3 → 4.0.4

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.
Files changed (39) hide show
  1. package/dist/neutral/address.d.ts +8 -0
  2. package/dist/neutral/address.d.ts.map +1 -0
  3. package/dist/neutral/assert.d.ts +4 -0
  4. package/dist/neutral/assert.d.ts.map +1 -0
  5. package/dist/neutral/hash.d.ts +10 -0
  6. package/dist/neutral/hash.d.ts.map +1 -0
  7. package/dist/neutral/hex/as.d.ts +5 -0
  8. package/dist/neutral/hex/as.d.ts.map +1 -0
  9. package/dist/neutral/hex/from/from.d.ts +3 -0
  10. package/dist/neutral/hex/from/from.d.ts.map +1 -0
  11. package/dist/neutral/hex/from/fromArrayBuffer.d.ts +3 -0
  12. package/dist/neutral/hex/from/fromArrayBuffer.d.ts.map +1 -0
  13. package/dist/neutral/hex/from/fromBigInt.d.ts +3 -0
  14. package/dist/neutral/hex/from/fromBigInt.d.ts.map +1 -0
  15. package/dist/neutral/hex/from/fromHexString.d.ts +3 -0
  16. package/dist/neutral/hex/from/fromHexString.d.ts.map +1 -0
  17. package/dist/neutral/hex/from/fromNumber.d.ts +3 -0
  18. package/dist/neutral/hex/from/fromNumber.d.ts.map +1 -0
  19. package/dist/neutral/hex/from/index.d.ts +6 -0
  20. package/dist/neutral/hex/from/index.d.ts.map +1 -0
  21. package/dist/neutral/hex/index.d.ts +10 -0
  22. package/dist/neutral/hex/index.d.ts.map +1 -0
  23. package/dist/neutral/hex/is.d.ts +3 -0
  24. package/dist/neutral/hex/is.d.ts.map +1 -0
  25. package/dist/neutral/hex/isHexZero.d.ts +2 -0
  26. package/dist/neutral/hex/isHexZero.d.ts.map +1 -0
  27. package/dist/neutral/hex/legacy.d.ts +2 -0
  28. package/dist/neutral/hex/legacy.d.ts.map +1 -0
  29. package/dist/neutral/hex/model.d.ts +7 -0
  30. package/dist/neutral/hex/model.d.ts.map +1 -0
  31. package/dist/neutral/hex/nibble.d.ts +3 -0
  32. package/dist/neutral/hex/nibble.d.ts.map +1 -0
  33. package/dist/neutral/hex/regex.d.ts +3 -0
  34. package/dist/neutral/hex/regex.d.ts.map +1 -0
  35. package/dist/neutral/hex/to.d.ts +3 -0
  36. package/dist/neutral/hex/to.d.ts.map +1 -0
  37. package/dist/neutral/index.d.ts +4 -52
  38. package/dist/neutral/index.d.ts.map +1 -0
  39. package/package.json +3 -3
@@ -0,0 +1,8 @@
1
+ import type { AssertConfig } from './assert.ts';
2
+ import type { Hex, HexConfig } from './hex/index.ts';
3
+ export type Address = Exclude<Hex, 'reserved-address-value'>;
4
+ export declare const toAddress: (value: string | number | bigint | ArrayBuffer, config?: HexConfig) => Lowercase<string>;
5
+ export declare const isAddress: (value: unknown, config?: HexConfig) => value is Address;
6
+ export declare function asAddress(value: unknown): Address | undefined;
7
+ export declare function asAddress(value: unknown, assert: AssertConfig): Address;
8
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../src/address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAKpD,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,wBAAwB,CAAC,CAAA;AAE5D,eAAO,MAAM,SAAS,UAAW,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,WAAU,SAAS,sBAKzF,CAAA;AAED,eAAO,MAAM,SAAS,UAAW,OAAO,WAAU,SAAS,KAAQ,KAAK,IAAI,OAG3E,CAAA;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAA;AAC9D,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAA"}
@@ -0,0 +1,4 @@
1
+ export type AssertCallback = (value: unknown, message: string) => string | boolean;
2
+ export type AssertConfig = string | AssertCallback | boolean;
3
+ export declare const assertError: (value: unknown, assert: AssertConfig | undefined, defaultMessage: string) => undefined;
4
+ //# sourceMappingURL=assert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../src/assert.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,OAAO,CAAA;AAElF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,CAAA;AAE5D,eAAO,MAAM,WAAW,UAAW,OAAO,UAAU,YAAY,GAAG,SAAS,kBAAkB,MAAM,cAcnG,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { AssertConfig } from './assert.ts';
2
+ import type { Hex } from './hex/index.ts';
3
+ export type HashBitLength = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
4
+ export declare const HashBitLength: HashBitLength[];
5
+ export declare const isHashBitLength: (value: unknown) => value is HashBitLength;
6
+ export type Hash = Exclude<Hex, 'reserved-hash-value'>;
7
+ export declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Hash;
8
+ export declare function asHash(value: unknown): Hash | undefined;
9
+ export declare function asHash(value: unknown, assert: AssertConfig): Hash;
10
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAA;AAGzC,MAAM,MAAM,aAAa,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;AAC1E,eAAO,MAAM,aAAa,EAAE,aAAa,EAA8C,CAAA;AAEvF,eAAO,MAAM,eAAe,UAAW,OAAO,KAAG,KAAK,IAAI,aAEzD,CAAA;AAED,MAAM,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA;AACtD,eAAO,MAAM,MAAM,UAAW,OAAO,cAAa,aAAa,KAAS,KAAK,IAAI,IAEhF,CAAA;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AACxD,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA"}
@@ -0,0 +1,5 @@
1
+ import type { AssertConfig } from '../assert.ts';
2
+ import type { Hex } from './model.ts';
3
+ export declare function asHex(value: unknown): Hex | undefined;
4
+ export declare function asHex(value: unknown, assert: AssertConfig): Hex;
5
+ //# sourceMappingURL=as.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"as.d.ts","sourceRoot":"","sources":["../../../src/hex/as.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AAErC,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,GAAG,GAAG,GAAG,SAAS,CAAA;AACtD,wBAAgB,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Hex, HexConfig } from '../model.ts';
2
+ export declare const hexFrom: (value: string | number | bigint | ArrayBuffer, config?: HexConfig) => Hex;
3
+ //# sourceMappingURL=from.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"from.d.ts","sourceRoot":"","sources":["../../../../src/hex/from/from.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAOjD,eAAO,MAAM,OAAO,UAEX,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,WAEpC,SAAS,KACjB,GAkBF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Hex, HexConfig } from '../model.ts';
2
+ export declare const hexFromArrayBuffer: (buffer: ArrayBuffer, config?: HexConfig) => Hex;
3
+ //# sourceMappingURL=fromArrayBuffer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromArrayBuffer.d.ts","sourceRoot":"","sources":["../../../../src/hex/from/fromArrayBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAIjD,eAAO,MAAM,kBAAkB,WAErB,WAAW,WAEV,SAAS,KACjB,GAGF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Hex, HexConfig } from '../model.ts';
2
+ export declare const hexFromBigInt: (value: bigint, config?: HexConfig) => Hex;
3
+ //# sourceMappingURL=fromBigInt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromBigInt.d.ts","sourceRoot":"","sources":["../../../../src/hex/from/fromBigInt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAKjD,eAAO,MAAM,aAAa,UAEjB,MAAM,WAEL,SAAS,KAChB,GAKF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Hex, HexConfig } from '../model.ts';
2
+ export declare const hexFromHexString: (value: string, config?: HexConfig) => Hex;
3
+ //# sourceMappingURL=fromHexString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromHexString.d.ts","sourceRoot":"","sources":["../../../../src/hex/from/fromHexString.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGjD,eAAO,MAAM,gBAAgB,UAAW,MAAM,WAAU,SAAS,KAAQ,GAUxE,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Hex, HexConfig } from '../model.ts';
2
+ export declare const hexFromNumber: (value: number, config?: HexConfig) => Hex;
3
+ //# sourceMappingURL=fromNumber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fromNumber.d.ts","sourceRoot":"","sources":["../../../../src/hex/from/fromNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAGjD,eAAO,MAAM,aAAa,UAAW,MAAM,WAAW,SAAS,KAAG,GAEjE,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from './from.ts';
2
+ export * from './fromArrayBuffer.ts';
3
+ export * from './fromBigInt.ts';
4
+ export * from './fromHexString.ts';
5
+ export * from './fromNumber.ts';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hex/from/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,sBAAsB,CAAA;AACpC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA"}
@@ -0,0 +1,10 @@
1
+ export * from './as.ts';
2
+ export * from './from/index.ts';
3
+ export * from './is.ts';
4
+ export * from './isHexZero.ts';
5
+ export * from './legacy.ts';
6
+ export * from './model.ts';
7
+ export * from './nibble.ts';
8
+ export * from './regex.ts';
9
+ export * from './to.ts';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hex/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Hex, HexConfig } from './model.ts';
2
+ export declare const isHex: (value: unknown, config?: HexConfig) => value is Hex;
3
+ //# sourceMappingURL=is.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../../src/hex/is.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAIhD,eAAO,MAAM,KAAK,UAAW,OAAO,WAAW,SAAS,KAAG,KAAK,IAAI,GAWnE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const isHexZero: (value?: string) => boolean | undefined;
2
+ //# sourceMappingURL=isHexZero.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isHexZero.d.ts","sourceRoot":"","sources":["../../../src/hex/isHexZero.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,WAAY,MAAM,wBAEvC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const toHexLegacy: (buffer: ArrayBuffer) => string;
2
+ //# sourceMappingURL=legacy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacy.d.ts","sourceRoot":"","sources":["../../../src/hex/legacy.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,WAAY,WAAW,WAE9C,CAAA"}
@@ -0,0 +1,7 @@
1
+ export type Hex = Exclude<Lowercase<string>, 'reserved-hex-value'>;
2
+ export interface HexConfig {
3
+ bitLength?: number;
4
+ byteSize?: number;
5
+ prefix?: boolean;
6
+ }
7
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/hex/model.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC,CAAA;AAGlE,MAAM,WAAW,SAAS;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB"}
@@ -0,0 +1,3 @@
1
+ export declare const bitsToNibbles: (value: number) => number;
2
+ export declare const nibblesToBits: (value: number) => number;
3
+ //# sourceMappingURL=nibble.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nibble.d.ts","sourceRoot":"","sources":["../../../src/hex/nibble.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,MAI7C,CAAA;AAGD,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,MAE7C,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const hexRegex: RegExp;
2
+ export declare const hexRegexWithPrefix: RegExp;
3
+ //# sourceMappingURL=regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"regex.d.ts","sourceRoot":"","sources":["../../../src/hex/regex.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,QAAgB,CAAA;AACrC,eAAO,MAAM,kBAAkB,QAAiB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { HexConfig } from './model.ts';
2
+ export declare const toHex: (value: string | number | bigint | ArrayBuffer, config?: HexConfig) => Lowercase<string>;
3
+ //# sourceMappingURL=to.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to.d.ts","sourceRoot":"","sources":["../../../src/hex/to.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAG3C,eAAO,MAAM,KAAK,UAET,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,WAErC,SAAS,sBAIlB,CAAA"}
@@ -1,52 +1,4 @@
1
- type AssertCallback = (value: unknown, message: string) => string | boolean;
2
- type AssertConfig = string | AssertCallback | boolean;
3
-
4
- type Hex = Exclude<Lowercase<string>, 'reserved-hex-value'>;
5
- interface HexConfig {
6
- bitLength?: number;
7
- byteSize?: number;
8
- prefix?: boolean;
9
- }
10
-
11
- declare function asHex(value: unknown): Hex | undefined;
12
- declare function asHex(value: unknown, assert: AssertConfig): Hex;
13
-
14
- declare const hexFrom: (value: string | number | bigint | ArrayBuffer, config?: HexConfig) => Hex;
15
-
16
- declare const hexFromArrayBuffer: (buffer: ArrayBuffer, config?: HexConfig) => Hex;
17
-
18
- declare const hexFromBigInt: (value: bigint, config?: HexConfig) => Hex;
19
-
20
- declare const hexFromHexString: (value: string, config?: HexConfig) => Hex;
21
-
22
- declare const hexFromNumber: (value: number, config?: HexConfig) => Hex;
23
-
24
- declare const isHex: (value: unknown, config?: HexConfig) => value is Hex;
25
-
26
- declare const isHexZero: (value?: string) => boolean | undefined;
27
-
28
- declare const toHexLegacy: (buffer: ArrayBuffer) => string;
29
-
30
- declare const bitsToNibbles: (value: number) => number;
31
- declare const nibblesToBits: (value: number) => number;
32
-
33
- declare const hexRegex: RegExp;
34
- declare const hexRegexWithPrefix: RegExp;
35
-
36
- declare const toHex: (value: string | number | bigint | ArrayBuffer, config?: HexConfig) => Lowercase<string>;
37
-
38
- type Address = Exclude<Hex, 'reserved-address-value'>;
39
- declare const toAddress: (value: string | number | bigint | ArrayBuffer, config?: HexConfig) => Lowercase<string>;
40
- declare const isAddress: (value: unknown, config?: HexConfig) => value is Address;
41
- declare function asAddress(value: unknown): Address | undefined;
42
- declare function asAddress(value: unknown, assert: AssertConfig): Address;
43
-
44
- type HashBitLength = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096;
45
- declare const HashBitLength: HashBitLength[];
46
- declare const isHashBitLength: (value: unknown) => value is HashBitLength;
47
- type Hash = Exclude<Hex, 'reserved-hash-value'>;
48
- declare const isHash: (value: unknown, bitLength?: HashBitLength) => value is Hash;
49
- declare function asHash(value: unknown): Hash | undefined;
50
- declare function asHash(value: unknown, assert: AssertConfig): Hash;
51
-
52
- export { type Address, type Hash, HashBitLength, type Hex, type HexConfig, asAddress, asHash, asHex, bitsToNibbles, hexFrom, hexFromArrayBuffer, hexFromBigInt, hexFromHexString, hexFromNumber, hexRegex, hexRegexWithPrefix, isAddress, isHash, isHashBitLength, isHex, isHexZero, nibblesToBits, toAddress, toHex, toHexLegacy };
1
+ export * from './address.ts';
2
+ export * from './hash.ts';
3
+ export * from './hex/index.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/hex",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "hex",
@@ -39,8 +39,8 @@
39
39
  "packages/**/*"
40
40
  ],
41
41
  "devDependencies": {
42
- "@xylabs/ts-scripts-yarn3": "^4.0.0",
43
- "@xylabs/tsconfig": "^4.0.0",
42
+ "@xylabs/ts-scripts-yarn3": "^4.0.7",
43
+ "@xylabs/tsconfig": "^4.0.7",
44
44
  "typescript": "^5.5.4"
45
45
  },
46
46
  "engines": {