@xylabs/eth-address 2.10.0 → 2.10.2

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/dist/index.d.mts CHANGED
@@ -1,4 +1,26 @@
1
- export { ellipsize } from './ellipsize.mjs';
2
- export { EthAddress, isEthAddress } from './EthAddress.mjs';
3
- export { padHex } from './padHex.mjs';
4
- import '@xylabs/bignumber';
1
+ import { BigNumber } from '@xylabs/bignumber';
2
+
3
+ declare const ellipsize: (value: string, length?: number) => string;
4
+
5
+ declare const isEthAddress: (obj: {
6
+ type: string;
7
+ }) => boolean;
8
+ declare class EthAddress {
9
+ static type: string;
10
+ type: string;
11
+ private address;
12
+ private constructor();
13
+ static fromString(value?: string, base?: number): EthAddress | undefined;
14
+ static parse(value: unknown, base?: number): EthAddress | undefined;
15
+ equals(address?: EthAddress | string | null): boolean;
16
+ toBigNumber(): BigNumber;
17
+ toHex(): string;
18
+ toJSON(): string;
19
+ toLowerCaseString(): string;
20
+ toShortString(length?: number): string;
21
+ toString(): string;
22
+ }
23
+
24
+ declare const padHex: (hex: string, byteCount?: number) => string;
25
+
26
+ export { EthAddress, ellipsize, isEthAddress, padHex };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,26 @@
1
- export { ellipsize } from './ellipsize.js';
2
- export { EthAddress, isEthAddress } from './EthAddress.js';
3
- export { padHex } from './padHex.js';
4
- import '@xylabs/bignumber';
1
+ import { BigNumber } from '@xylabs/bignumber';
2
+
3
+ declare const ellipsize: (value: string, length?: number) => string;
4
+
5
+ declare const isEthAddress: (obj: {
6
+ type: string;
7
+ }) => boolean;
8
+ declare class EthAddress {
9
+ static type: string;
10
+ type: string;
11
+ private address;
12
+ private constructor();
13
+ static fromString(value?: string, base?: number): EthAddress | undefined;
14
+ static parse(value: unknown, base?: number): EthAddress | undefined;
15
+ equals(address?: EthAddress | string | null): boolean;
16
+ toBigNumber(): BigNumber;
17
+ toHex(): string;
18
+ toJSON(): string;
19
+ toLowerCaseString(): string;
20
+ toShortString(length?: number): string;
21
+ toString(): string;
22
+ }
23
+
24
+ declare const padHex: (hex: string, byteCount?: number) => string;
25
+
26
+ export { EthAddress, ellipsize, isEthAddress, padHex };
package/package.json CHANGED
@@ -55,9 +55,8 @@
55
55
  "esm"
56
56
  ],
57
57
  "dependencies": {
58
- "@xylabs/assert": "~2.10.0",
59
- "@xylabs/bignumber": "~2.10.0",
60
- "tslib": "^2.6.2"
58
+ "@xylabs/assert": "~2.10.2",
59
+ "@xylabs/bignumber": "~2.10.2"
61
60
  },
62
61
  "devDependencies": {
63
62
  "@xylabs/ts-scripts-yarn3": "^2.19.5",
@@ -74,6 +73,6 @@
74
73
  "url": "https://github.com/xylabs/sdk-js.git"
75
74
  },
76
75
  "sideEffects": false,
77
- "version": "2.10.0",
76
+ "version": "2.10.2",
78
77
  "packageManager": "yarn@3.3.1"
79
78
  }
package/tsup.config.ts CHANGED
@@ -5,10 +5,12 @@ export default defineConfig({
5
5
  bundle: true,
6
6
  cjsInterop: true,
7
7
  clean: true,
8
- dts: true,
9
- entry: ['src'],
8
+ dts: {
9
+ entry: ['src/index.ts'],
10
+ },
11
+ entry: ['src/index.ts'],
10
12
  format: ['cjs', 'esm'],
11
13
  sourcemap: true,
12
14
  splitting: false,
13
- tsconfig: 'tsconfig.json',
15
+ tsconfig: 'tsconfig.build.json',
14
16
  })
@@ -1,22 +0,0 @@
1
- import { BigNumber } from '@xylabs/bignumber';
2
-
3
- declare const isEthAddress: (obj: {
4
- type: string;
5
- }) => boolean;
6
- declare class EthAddress {
7
- static type: string;
8
- type: string;
9
- private address;
10
- private constructor();
11
- static fromString(value?: string, base?: number): EthAddress | undefined;
12
- static parse(value: unknown, base?: number): EthAddress | undefined;
13
- equals(address?: EthAddress | string | null): boolean;
14
- toBigNumber(): BigNumber;
15
- toHex(): string;
16
- toJSON(): string;
17
- toLowerCaseString(): string;
18
- toShortString(length?: number): string;
19
- toString(): string;
20
- }
21
-
22
- export { EthAddress, isEthAddress };
@@ -1,22 +0,0 @@
1
- import { BigNumber } from '@xylabs/bignumber';
2
-
3
- declare const isEthAddress: (obj: {
4
- type: string;
5
- }) => boolean;
6
- declare class EthAddress {
7
- static type: string;
8
- type: string;
9
- private address;
10
- private constructor();
11
- static fromString(value?: string, base?: number): EthAddress | undefined;
12
- static parse(value: unknown, base?: number): EthAddress | undefined;
13
- equals(address?: EthAddress | string | null): boolean;
14
- toBigNumber(): BigNumber;
15
- toHex(): string;
16
- toJSON(): string;
17
- toLowerCaseString(): string;
18
- toShortString(length?: number): string;
19
- toString(): string;
20
- }
21
-
22
- export { EthAddress, isEthAddress };
@@ -1,107 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/EthAddress.ts
21
- var EthAddress_exports = {};
22
- __export(EthAddress_exports, {
23
- EthAddress: () => EthAddress,
24
- isEthAddress: () => isEthAddress
25
- });
26
- module.exports = __toCommonJS(EthAddress_exports);
27
- var import_assert = require("@xylabs/assert");
28
- var import_bignumber = require("@xylabs/bignumber");
29
-
30
- // src/ellipsize.ts
31
- var ellipsize = (value, length = 2) => {
32
- const part1 = value.slice(0, length);
33
- const part2 = value.slice(value.length - length, value.length);
34
- return `${part1}...${part2}`;
35
- };
36
-
37
- // src/padHex.ts
38
- var padHex = (hex, byteCount) => {
39
- let result = hex;
40
- if (hex.length % 2 !== 0) {
41
- result = `0${hex}`;
42
- }
43
- if (byteCount) {
44
- while (result.length / 2 < byteCount) {
45
- result = `00${result}`;
46
- }
47
- }
48
- return result;
49
- };
50
-
51
- // src/EthAddress.ts
52
- var isEthAddress = (obj) => obj?.type === EthAddress.type;
53
- var EthAddress = class _EthAddress {
54
- static type = "EthAddress";
55
- type = _EthAddress.type;
56
- address;
57
- constructor(address) {
58
- this.address = address;
59
- }
60
- static fromString(value, base = 16) {
61
- if (value) {
62
- const bn = new import_bignumber.BigNumber(value.startsWith("0x") ? value.substring(2) : value, base);
63
- return new _EthAddress(bn);
64
- }
65
- }
66
- static parse(value, base) {
67
- if (typeof value === "string") {
68
- return this.fromString(value, base);
69
- }
70
- }
71
- equals(address) {
72
- if (address) {
73
- let inAddress;
74
- if (typeof address === "string") {
75
- inAddress = (0, import_assert.assertEx)(_EthAddress.fromString(address), "Bad Address");
76
- } else {
77
- inAddress = address;
78
- }
79
- return this.address.eq(inAddress.address);
80
- }
81
- return false;
82
- }
83
- toBigNumber() {
84
- return this.address;
85
- }
86
- toHex() {
87
- return padHex(this.address.toString(16), 20);
88
- }
89
- toJSON() {
90
- return `0x${this.toHex()}`;
91
- }
92
- toLowerCaseString() {
93
- return this.toString().toLowerCase();
94
- }
95
- toShortString(length = 2) {
96
- return `0x${ellipsize(this.toHex(), length)}`;
97
- }
98
- toString() {
99
- return `0x${this.toHex()}`;
100
- }
101
- };
102
- // Annotate the CommonJS export names for ESM import in node:
103
- 0 && (module.exports = {
104
- EthAddress,
105
- isEthAddress
106
- });
107
- //# sourceMappingURL=EthAddress.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/EthAddress.ts","../src/ellipsize.ts","../src/padHex.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { BigNumber } from '@xylabs/bignumber'\n\nimport { ellipsize } from './ellipsize'\nimport { padHex } from './padHex'\n\nexport const isEthAddress = (obj: { type: string }) => obj?.type === EthAddress.type\n\nexport class EthAddress {\n static type = 'EthAddress'\n\n public type = EthAddress.type\n\n private address: BigNumber\n\n private constructor(address: BigNumber) {\n this.address = address\n }\n\n static fromString(value?: string, base = 16) {\n if (value) {\n const bn = new BigNumber(value.startsWith('0x') ? value.substring(2) : value, base)\n return new EthAddress(bn)\n }\n }\n\n static parse(value: unknown, base?: number) {\n if (typeof value === 'string') {\n return this.fromString(value, base)\n }\n }\n\n public equals(address?: EthAddress | string | null): boolean {\n if (address) {\n let inAddress: EthAddress\n if (typeof address === 'string') {\n inAddress = assertEx(EthAddress.fromString(address), 'Bad Address')\n } else {\n inAddress = address\n }\n return this.address.eq(inAddress.address)\n }\n return false\n }\n\n public toBigNumber() {\n return this.address\n }\n\n public toHex() {\n return padHex(this.address.toString(16), 20)\n }\n\n public toJSON(): string {\n return `0x${this.toHex()}`\n }\n\n public toLowerCaseString() {\n return this.toString().toLowerCase()\n }\n\n public toShortString(length = 2) {\n return `0x${ellipsize(this.toHex(), length)}`\n }\n\n public toString() {\n return `0x${this.toHex()}`\n }\n}\n","export const ellipsize = (value: string, length = 2) => {\n const part1 = value.slice(0, length)\n const part2 = value.slice(value.length - length, value.length)\n return `${part1}...${part2}`\n}\n","const padHex = (hex: string, byteCount?: number) => {\n let result = hex\n if (hex.length % 2 !== 0) {\n result = `0${hex}`\n }\n if (byteCount) {\n while (result.length / 2 < byteCount) {\n result = `00${result}`\n }\n }\n return result\n}\n\nexport { padHex }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyB;AACzB,uBAA0B;;;ACDnB,IAAM,YAAY,CAAC,OAAe,SAAS,MAAM;AACtD,QAAM,QAAQ,MAAM,MAAM,GAAG,MAAM;AACnC,QAAM,QAAQ,MAAM,MAAM,MAAM,SAAS,QAAQ,MAAM,MAAM;AAC7D,SAAO,GAAG,KAAK,MAAM,KAAK;AAC5B;;;ACJA,IAAM,SAAS,CAAC,KAAa,cAAuB;AAClD,MAAI,SAAS;AACb,MAAI,IAAI,SAAS,MAAM,GAAG;AACxB,aAAS,IAAI,GAAG;AAAA,EAClB;AACA,MAAI,WAAW;AACb,WAAO,OAAO,SAAS,IAAI,WAAW;AACpC,eAAS,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AACA,SAAO;AACT;;;AFLO,IAAM,eAAe,CAAC,QAA0B,KAAK,SAAS,WAAW;AAEzE,IAAM,aAAN,MAAM,YAAW;AAAA,EACtB,OAAO,OAAO;AAAA,EAEP,OAAO,YAAW;AAAA,EAEjB;AAAA,EAEA,YAAY,SAAoB;AACtC,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,OAAO,WAAW,OAAgB,OAAO,IAAI;AAC3C,QAAI,OAAO;AACT,YAAM,KAAK,IAAI,2BAAU,MAAM,WAAW,IAAI,IAAI,MAAM,UAAU,CAAC,IAAI,OAAO,IAAI;AAClF,aAAO,IAAI,YAAW,EAAE;AAAA,IAC1B;AAAA,EACF;AAAA,EAEA,OAAO,MAAM,OAAgB,MAAe;AAC1C,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO,KAAK,WAAW,OAAO,IAAI;AAAA,IACpC;AAAA,EACF;AAAA,EAEO,OAAO,SAA+C;AAC3D,QAAI,SAAS;AACX,UAAI;AACJ,UAAI,OAAO,YAAY,UAAU;AAC/B,wBAAY,wBAAS,YAAW,WAAW,OAAO,GAAG,aAAa;AAAA,MACpE,OAAO;AACL,oBAAY;AAAA,MACd;AACA,aAAO,KAAK,QAAQ,GAAG,UAAU,OAAO;AAAA,IAC1C;AACA,WAAO;AAAA,EACT;AAAA,EAEO,cAAc;AACnB,WAAO,KAAK;AAAA,EACd;AAAA,EAEO,QAAQ;AACb,WAAO,OAAO,KAAK,QAAQ,SAAS,EAAE,GAAG,EAAE;AAAA,EAC7C;AAAA,EAEO,SAAiB;AACtB,WAAO,KAAK,KAAK,MAAM,CAAC;AAAA,EAC1B;AAAA,EAEO,oBAAoB;AACzB,WAAO,KAAK,SAAS,EAAE,YAAY;AAAA,EACrC;AAAA,EAEO,cAAc,SAAS,GAAG;AAC/B,WAAO,KAAK,UAAU,KAAK,MAAM,GAAG,MAAM,CAAC;AAAA,EAC7C;AAAA,EAEO,WAAW;AAChB,WAAO,KAAK,KAAK,MAAM,CAAC;AAAA,EAC1B;AACF;","names":[]}
@@ -1,81 +0,0 @@
1
- // src/EthAddress.ts
2
- import { assertEx } from "@xylabs/assert";
3
- import { BigNumber } from "@xylabs/bignumber";
4
-
5
- // src/ellipsize.ts
6
- var ellipsize = (value, length = 2) => {
7
- const part1 = value.slice(0, length);
8
- const part2 = value.slice(value.length - length, value.length);
9
- return `${part1}...${part2}`;
10
- };
11
-
12
- // src/padHex.ts
13
- var padHex = (hex, byteCount) => {
14
- let result = hex;
15
- if (hex.length % 2 !== 0) {
16
- result = `0${hex}`;
17
- }
18
- if (byteCount) {
19
- while (result.length / 2 < byteCount) {
20
- result = `00${result}`;
21
- }
22
- }
23
- return result;
24
- };
25
-
26
- // src/EthAddress.ts
27
- var isEthAddress = (obj) => obj?.type === EthAddress.type;
28
- var EthAddress = class _EthAddress {
29
- static type = "EthAddress";
30
- type = _EthAddress.type;
31
- address;
32
- constructor(address) {
33
- this.address = address;
34
- }
35
- static fromString(value, base = 16) {
36
- if (value) {
37
- const bn = new BigNumber(value.startsWith("0x") ? value.substring(2) : value, base);
38
- return new _EthAddress(bn);
39
- }
40
- }
41
- static parse(value, base) {
42
- if (typeof value === "string") {
43
- return this.fromString(value, base);
44
- }
45
- }
46
- equals(address) {
47
- if (address) {
48
- let inAddress;
49
- if (typeof address === "string") {
50
- inAddress = assertEx(_EthAddress.fromString(address), "Bad Address");
51
- } else {
52
- inAddress = address;
53
- }
54
- return this.address.eq(inAddress.address);
55
- }
56
- return false;
57
- }
58
- toBigNumber() {
59
- return this.address;
60
- }
61
- toHex() {
62
- return padHex(this.address.toString(16), 20);
63
- }
64
- toJSON() {
65
- return `0x${this.toHex()}`;
66
- }
67
- toLowerCaseString() {
68
- return this.toString().toLowerCase();
69
- }
70
- toShortString(length = 2) {
71
- return `0x${ellipsize(this.toHex(), length)}`;
72
- }
73
- toString() {
74
- return `0x${this.toHex()}`;
75
- }
76
- };
77
- export {
78
- EthAddress,
79
- isEthAddress
80
- };
81
- //# sourceMappingURL=EthAddress.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/EthAddress.ts","../src/ellipsize.ts","../src/padHex.ts"],"sourcesContent":["import { assertEx } from '@xylabs/assert'\nimport { BigNumber } from '@xylabs/bignumber'\n\nimport { ellipsize } from './ellipsize'\nimport { padHex } from './padHex'\n\nexport const isEthAddress = (obj: { type: string }) => obj?.type === EthAddress.type\n\nexport class EthAddress {\n static type = 'EthAddress'\n\n public type = EthAddress.type\n\n private address: BigNumber\n\n private constructor(address: BigNumber) {\n this.address = address\n }\n\n static fromString(value?: string, base = 16) {\n if (value) {\n const bn = new BigNumber(value.startsWith('0x') ? value.substring(2) : value, base)\n return new EthAddress(bn)\n }\n }\n\n static parse(value: unknown, base?: number) {\n if (typeof value === 'string') {\n return this.fromString(value, base)\n }\n }\n\n public equals(address?: EthAddress | string | null): boolean {\n if (address) {\n let inAddress: EthAddress\n if (typeof address === 'string') {\n inAddress = assertEx(EthAddress.fromString(address), 'Bad Address')\n } else {\n inAddress = address\n }\n return this.address.eq(inAddress.address)\n }\n return false\n }\n\n public toBigNumber() {\n return this.address\n }\n\n public toHex() {\n return padHex(this.address.toString(16), 20)\n }\n\n public toJSON(): string {\n return `0x${this.toHex()}`\n }\n\n public toLowerCaseString() {\n return this.toString().toLowerCase()\n }\n\n public toShortString(length = 2) {\n return `0x${ellipsize(this.toHex(), length)}`\n }\n\n public toString() {\n return `0x${this.toHex()}`\n }\n}\n","export const ellipsize = (value: string, length = 2) => {\n const part1 = value.slice(0, length)\n const part2 = value.slice(value.length - length, value.length)\n return `${part1}...${part2}`\n}\n","const padHex = (hex: string, byteCount?: number) => {\n let result = hex\n if (hex.length % 2 !== 0) {\n result = `0${hex}`\n }\n if (byteCount) {\n while (result.length / 2 < byteCount) {\n result = `00${result}`\n }\n }\n return result\n}\n\nexport { padHex }\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;;;ACDnB,IAAM,YAAY,CAAC,OAAe,SAAS,MAAM;AACtD,QAAM,QAAQ,MAAM,MAAM,GAAG,MAAM;AACnC,QAAM,QAAQ,MAAM,MAAM,MAAM,SAAS,QAAQ,MAAM,MAAM;AAC7D,SAAO,GAAG,KAAK,MAAM,KAAK;AAC5B;;;ACJA,IAAM,SAAS,CAAC,KAAa,cAAuB;AAClD,MAAI,SAAS;AACb,MAAI,IAAI,SAAS,MAAM,GAAG;AACxB,aAAS,IAAI,GAAG;AAAA,EAClB;AACA,MAAI,WAAW;AACb,WAAO,OAAO,SAAS,IAAI,WAAW;AACpC,eAAS,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AACA,SAAO;AACT;;;AFLO,IAAM,eAAe,CAAC,QAA0B,KAAK,SAAS,WAAW;AAEzE,IAAM,aAAN,MAAM,YAAW;AAAA,EACtB,OAAO,OAAO;AAAA,EAEP,OAAO,YAAW;AAAA,EAEjB;AAAA,EAEA,YAAY,SAAoB;AACtC,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,OAAO,WAAW,OAAgB,OAAO,IAAI;AAC3C,QAAI,OAAO;AACT,YAAM,KAAK,IAAI,UAAU,MAAM,WAAW,IAAI,IAAI,MAAM,UAAU,CAAC,IAAI,OAAO,IAAI;AAClF,aAAO,IAAI,YAAW,EAAE;AAAA,IAC1B;AAAA,EACF;AAAA,EAEA,OAAO,MAAM,OAAgB,MAAe;AAC1C,QAAI,OAAO,UAAU,UAAU;AAC7B,aAAO,KAAK,WAAW,OAAO,IAAI;AAAA,IACpC;AAAA,EACF;AAAA,EAEO,OAAO,SAA+C;AAC3D,QAAI,SAAS;AACX,UAAI;AACJ,UAAI,OAAO,YAAY,UAAU;AAC/B,oBAAY,SAAS,YAAW,WAAW,OAAO,GAAG,aAAa;AAAA,MACpE,OAAO;AACL,oBAAY;AAAA,MACd;AACA,aAAO,KAAK,QAAQ,GAAG,UAAU,OAAO;AAAA,IAC1C;AACA,WAAO;AAAA,EACT;AAAA,EAEO,cAAc;AACnB,WAAO,KAAK;AAAA,EACd;AAAA,EAEO,QAAQ;AACb,WAAO,OAAO,KAAK,QAAQ,SAAS,EAAE,GAAG,EAAE;AAAA,EAC7C;AAAA,EAEO,SAAiB;AACtB,WAAO,KAAK,KAAK,MAAM,CAAC;AAAA,EAC1B;AAAA,EAEO,oBAAoB;AACzB,WAAO,KAAK,SAAS,EAAE,YAAY;AAAA,EACrC;AAAA,EAEO,cAAc,SAAS,GAAG;AAC/B,WAAO,KAAK,UAAU,KAAK,MAAM,GAAG,MAAM,CAAC;AAAA,EAC7C;AAAA,EAEO,WAAW;AAChB,WAAO,KAAK,KAAK,MAAM,CAAC;AAAA,EAC1B;AACF;","names":[]}
@@ -1,3 +0,0 @@
1
- declare const ellipsize: (value: string, length?: number) => string;
2
-
3
- export { ellipsize };
@@ -1,3 +0,0 @@
1
- declare const ellipsize: (value: string, length?: number) => string;
2
-
3
- export { ellipsize };
package/dist/ellipsize.js DELETED
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/ellipsize.ts
21
- var ellipsize_exports = {};
22
- __export(ellipsize_exports, {
23
- ellipsize: () => ellipsize
24
- });
25
- module.exports = __toCommonJS(ellipsize_exports);
26
- var ellipsize = (value, length = 2) => {
27
- const part1 = value.slice(0, length);
28
- const part2 = value.slice(value.length - length, value.length);
29
- return `${part1}...${part2}`;
30
- };
31
- // Annotate the CommonJS export names for ESM import in node:
32
- 0 && (module.exports = {
33
- ellipsize
34
- });
35
- //# sourceMappingURL=ellipsize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ellipsize.ts"],"sourcesContent":["export const ellipsize = (value: string, length = 2) => {\n const part1 = value.slice(0, length)\n const part2 = value.slice(value.length - length, value.length)\n return `${part1}...${part2}`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,YAAY,CAAC,OAAe,SAAS,MAAM;AACtD,QAAM,QAAQ,MAAM,MAAM,GAAG,MAAM;AACnC,QAAM,QAAQ,MAAM,MAAM,MAAM,SAAS,QAAQ,MAAM,MAAM;AAC7D,SAAO,GAAG,KAAK,MAAM,KAAK;AAC5B;","names":[]}
@@ -1,10 +0,0 @@
1
- // src/ellipsize.ts
2
- var ellipsize = (value, length = 2) => {
3
- const part1 = value.slice(0, length);
4
- const part2 = value.slice(value.length - length, value.length);
5
- return `${part1}...${part2}`;
6
- };
7
- export {
8
- ellipsize
9
- };
10
- //# sourceMappingURL=ellipsize.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ellipsize.ts"],"sourcesContent":["export const ellipsize = (value: string, length = 2) => {\n const part1 = value.slice(0, length)\n const part2 = value.slice(value.length - length, value.length)\n return `${part1}...${part2}`\n}\n"],"mappings":";AAAO,IAAM,YAAY,CAAC,OAAe,SAAS,MAAM;AACtD,QAAM,QAAQ,MAAM,MAAM,GAAG,MAAM;AACnC,QAAM,QAAQ,MAAM,MAAM,MAAM,SAAS,QAAQ,MAAM,MAAM;AAC7D,SAAO,GAAG,KAAK,MAAM,KAAK;AAC5B;","names":[]}
package/dist/padHex.d.mts DELETED
@@ -1,3 +0,0 @@
1
- declare const padHex: (hex: string, byteCount?: number) => string;
2
-
3
- export { padHex };
package/dist/padHex.d.ts DELETED
@@ -1,3 +0,0 @@
1
- declare const padHex: (hex: string, byteCount?: number) => string;
2
-
3
- export { padHex };
package/dist/padHex.js DELETED
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/padHex.ts
21
- var padHex_exports = {};
22
- __export(padHex_exports, {
23
- padHex: () => padHex
24
- });
25
- module.exports = __toCommonJS(padHex_exports);
26
- var padHex = (hex, byteCount) => {
27
- let result = hex;
28
- if (hex.length % 2 !== 0) {
29
- result = `0${hex}`;
30
- }
31
- if (byteCount) {
32
- while (result.length / 2 < byteCount) {
33
- result = `00${result}`;
34
- }
35
- }
36
- return result;
37
- };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- padHex
41
- });
42
- //# sourceMappingURL=padHex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/padHex.ts"],"sourcesContent":["const padHex = (hex: string, byteCount?: number) => {\n let result = hex\n if (hex.length % 2 !== 0) {\n result = `0${hex}`\n }\n if (byteCount) {\n while (result.length / 2 < byteCount) {\n result = `00${result}`\n }\n }\n return result\n}\n\nexport { padHex }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAM,SAAS,CAAC,KAAa,cAAuB;AAClD,MAAI,SAAS;AACb,MAAI,IAAI,SAAS,MAAM,GAAG;AACxB,aAAS,IAAI,GAAG;AAAA,EAClB;AACA,MAAI,WAAW;AACb,WAAO,OAAO,SAAS,IAAI,WAAW;AACpC,eAAS,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
package/dist/padHex.mjs DELETED
@@ -1,17 +0,0 @@
1
- // src/padHex.ts
2
- var padHex = (hex, byteCount) => {
3
- let result = hex;
4
- if (hex.length % 2 !== 0) {
5
- result = `0${hex}`;
6
- }
7
- if (byteCount) {
8
- while (result.length / 2 < byteCount) {
9
- result = `00${result}`;
10
- }
11
- }
12
- return result;
13
- };
14
- export {
15
- padHex
16
- };
17
- //# sourceMappingURL=padHex.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/padHex.ts"],"sourcesContent":["const padHex = (hex: string, byteCount?: number) => {\n let result = hex\n if (hex.length % 2 !== 0) {\n result = `0${hex}`\n }\n if (byteCount) {\n while (result.length / 2 < byteCount) {\n result = `00${result}`\n }\n }\n return result\n}\n\nexport { padHex }\n"],"mappings":";AAAA,IAAM,SAAS,CAAC,KAAa,cAAuB;AAClD,MAAI,SAAS;AACb,MAAI,IAAI,SAAS,MAAM,GAAG;AACxB,aAAS,IAAI,GAAG;AAAA,EAClB;AACA,MAAI,WAAW;AACb,WAAO,OAAO,SAAS,IAAI,WAAW;AACpC,eAAS,KAAK,MAAM;AAAA,IACtB;AAAA,EACF;AACA,SAAO;AACT;","names":[]}