@sudobility/types 1.8.21
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/CLAUDE.md +285 -0
- package/README.md +310 -0
- package/dist/index.cjs +62 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/types/blockchain/common.cjs +102 -0
- package/dist/types/blockchain/common.d.ts +262 -0
- package/dist/types/blockchain/common.d.ts.map +1 -0
- package/dist/types/blockchain/common.js +102 -0
- package/dist/types/blockchain/common.js.map +1 -0
- package/dist/types/blockchain/index.cjs +18 -0
- package/dist/types/blockchain/index.d.ts +4 -0
- package/dist/types/blockchain/index.d.ts.map +1 -0
- package/dist/types/blockchain/index.js +18 -0
- package/dist/types/blockchain/index.js.map +1 -0
- package/dist/types/blockchain/validation.cjs +88 -0
- package/dist/types/blockchain/validation.d.ts +9 -0
- package/dist/types/blockchain/validation.d.ts.map +1 -0
- package/dist/types/blockchain/validation.js +88 -0
- package/dist/types/blockchain/validation.js.map +1 -0
- package/dist/types/business/enums.cjs +314 -0
- package/dist/types/business/enums.d.ts +227 -0
- package/dist/types/business/enums.d.ts.map +1 -0
- package/dist/types/business/enums.js +314 -0
- package/dist/types/business/enums.js.map +1 -0
- package/dist/types/business/index.cjs +33 -0
- package/dist/types/business/index.d.ts +5 -0
- package/dist/types/business/index.d.ts.map +1 -0
- package/dist/types/business/index.js +33 -0
- package/dist/types/business/index.js.map +1 -0
- package/dist/types/business/wallet-status.cjs +38 -0
- package/dist/types/business/wallet-status.d.ts +32 -0
- package/dist/types/business/wallet-status.d.ts.map +1 -0
- package/dist/types/business/wallet-status.js +38 -0
- package/dist/types/business/wallet-status.js.map +1 -0
- package/dist/types/common.cjs +6 -0
- package/dist/types/common.d.ts +142 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +6 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config/app-config.cjs +6 -0
- package/dist/types/config/app-config.d.ts +67 -0
- package/dist/types/config/app-config.d.ts.map +1 -0
- package/dist/types/config/app-config.js +6 -0
- package/dist/types/config/app-config.js.map +1 -0
- package/dist/types/config/environment.cjs +24 -0
- package/dist/types/config/environment.d.ts +68 -0
- package/dist/types/config/environment.d.ts.map +1 -0
- package/dist/types/config/environment.js +24 -0
- package/dist/types/config/environment.js.map +1 -0
- package/dist/types/config/index.cjs +6 -0
- package/dist/types/config/index.d.ts +4 -0
- package/dist/types/config/index.d.ts.map +1 -0
- package/dist/types/config/index.js +6 -0
- package/dist/types/config/index.js.map +1 -0
- package/dist/types/index.cjs +35 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +35 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/indexer/index.cjs +19 -0
- package/dist/types/indexer/index.d.ts +3 -0
- package/dist/types/indexer/index.d.ts.map +1 -0
- package/dist/types/indexer/index.js +19 -0
- package/dist/types/indexer/index.js.map +1 -0
- package/dist/types/indexer/indexer-guards.cjs +145 -0
- package/dist/types/indexer/indexer-guards.d.ts +26 -0
- package/dist/types/indexer/indexer-guards.d.ts.map +1 -0
- package/dist/types/indexer/indexer-guards.js +145 -0
- package/dist/types/indexer/indexer-guards.js.map +1 -0
- package/dist/types/indexer/indexer-responses.cjs +8 -0
- package/dist/types/indexer/indexer-responses.d.ts +136 -0
- package/dist/types/indexer/indexer-responses.d.ts.map +1 -0
- package/dist/types/indexer/indexer-responses.js +8 -0
- package/dist/types/indexer/indexer-responses.js.map +1 -0
- package/dist/types/infrastructure/analytics.cjs +212 -0
- package/dist/types/infrastructure/analytics.d.ts +449 -0
- package/dist/types/infrastructure/analytics.d.ts.map +1 -0
- package/dist/types/infrastructure/analytics.js +212 -0
- package/dist/types/infrastructure/analytics.js.map +1 -0
- package/dist/types/infrastructure/api.cjs +17 -0
- package/dist/types/infrastructure/api.d.ts +152 -0
- package/dist/types/infrastructure/api.d.ts.map +1 -0
- package/dist/types/infrastructure/api.js +17 -0
- package/dist/types/infrastructure/api.js.map +1 -0
- package/dist/types/infrastructure/index.cjs +14 -0
- package/dist/types/infrastructure/index.d.ts +9 -0
- package/dist/types/infrastructure/index.d.ts.map +1 -0
- package/dist/types/infrastructure/index.js +14 -0
- package/dist/types/infrastructure/index.js.map +1 -0
- package/dist/types/infrastructure/navigation.cjs +3 -0
- package/dist/types/infrastructure/navigation.d.ts +56 -0
- package/dist/types/infrastructure/navigation.d.ts.map +1 -0
- package/dist/types/infrastructure/navigation.js +3 -0
- package/dist/types/infrastructure/navigation.js.map +1 -0
- package/dist/types/infrastructure/network.cjs +18 -0
- package/dist/types/infrastructure/network.d.ts +48 -0
- package/dist/types/infrastructure/network.d.ts.map +1 -0
- package/dist/types/infrastructure/network.js +18 -0
- package/dist/types/infrastructure/network.js.map +1 -0
- package/dist/types/infrastructure/wallet.cjs +37 -0
- package/dist/types/infrastructure/wallet.d.ts +33 -0
- package/dist/types/infrastructure/wallet.d.ts.map +1 -0
- package/dist/types/infrastructure/wallet.js +37 -0
- package/dist/types/infrastructure/wallet.js.map +1 -0
- package/dist/types/kyc/index.cjs +19 -0
- package/dist/types/kyc/index.d.ts +2 -0
- package/dist/types/kyc/index.d.ts.map +1 -0
- package/dist/types/kyc/index.js +19 -0
- package/dist/types/kyc/index.js.map +1 -0
- package/dist/types/kyc/kyc-types.cjs +12 -0
- package/dist/types/kyc/kyc-types.d.ts +260 -0
- package/dist/types/kyc/kyc-types.d.ts.map +1 -0
- package/dist/types/kyc/kyc-types.js +12 -0
- package/dist/types/kyc/kyc-types.js.map +1 -0
- package/dist/types/mailer/index.cjs +19 -0
- package/dist/types/mailer/index.d.ts +2 -0
- package/dist/types/mailer/index.d.ts.map +1 -0
- package/dist/types/mailer/index.js +19 -0
- package/dist/types/mailer/index.js.map +1 -0
- package/dist/types/mailer/mail-types.cjs +38 -0
- package/dist/types/mailer/mail-types.d.ts +296 -0
- package/dist/types/mailer/mail-types.d.ts.map +1 -0
- package/dist/types/mailer/mail-types.js +38 -0
- package/dist/types/mailer/mail-types.js.map +1 -0
- package/dist/types/wildduck/index.cjs +19 -0
- package/dist/types/wildduck/index.d.ts +2 -0
- package/dist/types/wildduck/index.d.ts.map +1 -0
- package/dist/types/wildduck/index.js +19 -0
- package/dist/types/wildduck/index.js.map +1 -0
- package/dist/types/wildduck/wildduck-types.cjs +48 -0
- package/dist/types/wildduck/wildduck-types.d.ts +1239 -0
- package/dist/types/wildduck/wildduck-types.d.ts.map +1 -0
- package/dist/types/wildduck/wildduck-types.js +48 -0
- package/dist/types/wildduck/wildduck-types.js.map +1 -0
- package/dist/utils/async-helpers.cjs +130 -0
- package/dist/utils/async-helpers.d.ts +35 -0
- package/dist/utils/async-helpers.d.ts.map +1 -0
- package/dist/utils/async-helpers.js +130 -0
- package/dist/utils/async-helpers.js.map +1 -0
- package/dist/utils/auth/auth.cjs +96 -0
- package/dist/utils/auth/auth.d.ts +40 -0
- package/dist/utils/auth/auth.d.ts.map +1 -0
- package/dist/utils/auth/auth.js +96 -0
- package/dist/utils/auth/auth.js.map +1 -0
- package/dist/utils/auth/index.cjs +14 -0
- package/dist/utils/auth/index.d.ts +2 -0
- package/dist/utils/auth/index.d.ts.map +1 -0
- package/dist/utils/auth/index.js +14 -0
- package/dist/utils/auth/index.js.map +1 -0
- package/dist/utils/blockchain/address.cjs +231 -0
- package/dist/utils/blockchain/address.d.ts +65 -0
- package/dist/utils/blockchain/address.d.ts.map +1 -0
- package/dist/utils/blockchain/address.js +231 -0
- package/dist/utils/blockchain/address.js.map +1 -0
- package/dist/utils/blockchain/event-helpers.cjs +143 -0
- package/dist/utils/blockchain/event-helpers.d.ts +87 -0
- package/dist/utils/blockchain/event-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/event-helpers.js +143 -0
- package/dist/utils/blockchain/event-helpers.js.map +1 -0
- package/dist/utils/blockchain/index.cjs +30 -0
- package/dist/utils/blockchain/index.d.ts +8 -0
- package/dist/utils/blockchain/index.d.ts.map +1 -0
- package/dist/utils/blockchain/index.js +30 -0
- package/dist/utils/blockchain/index.js.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.cjs +865 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts +251 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.js +865 -0
- package/dist/utils/blockchain/rpc-helpers.js.map +1 -0
- package/dist/utils/constants/application.cjs +158 -0
- package/dist/utils/constants/application.d.ts +119 -0
- package/dist/utils/constants/application.d.ts.map +1 -0
- package/dist/utils/constants/application.js +158 -0
- package/dist/utils/constants/application.js.map +1 -0
- package/dist/utils/constants/index.cjs +30 -0
- package/dist/utils/constants/index.d.ts +7 -0
- package/dist/utils/constants/index.d.ts.map +1 -0
- package/dist/utils/constants/index.js +30 -0
- package/dist/utils/constants/index.js.map +1 -0
- package/dist/utils/constants/status-values.cjs +14 -0
- package/dist/utils/constants/status-values.d.ts +12 -0
- package/dist/utils/constants/status-values.d.ts.map +1 -0
- package/dist/utils/constants/status-values.js +14 -0
- package/dist/utils/constants/status-values.js.map +1 -0
- package/dist/utils/formatting/currency.cjs +36 -0
- package/dist/utils/formatting/currency.d.ts +26 -0
- package/dist/utils/formatting/currency.d.ts.map +1 -0
- package/dist/utils/formatting/currency.js +36 -0
- package/dist/utils/formatting/currency.js.map +1 -0
- package/dist/utils/formatting/date.cjs +138 -0
- package/dist/utils/formatting/date.d.ts +33 -0
- package/dist/utils/formatting/date.d.ts.map +1 -0
- package/dist/utils/formatting/date.js +138 -0
- package/dist/utils/formatting/date.js.map +1 -0
- package/dist/utils/formatting/index.cjs +37 -0
- package/dist/utils/formatting/index.d.ts +4 -0
- package/dist/utils/formatting/index.d.ts.map +1 -0
- package/dist/utils/formatting/index.js +37 -0
- package/dist/utils/formatting/index.js.map +1 -0
- package/dist/utils/formatting/string.cjs +193 -0
- package/dist/utils/formatting/string.d.ts +69 -0
- package/dist/utils/formatting/string.d.ts.map +1 -0
- package/dist/utils/formatting/string.js +193 -0
- package/dist/utils/formatting/string.js.map +1 -0
- package/dist/utils/index.cjs +28 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +28 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging/index.cjs +16 -0
- package/dist/utils/logging/index.d.ts +5 -0
- package/dist/utils/logging/index.d.ts.map +1 -0
- package/dist/utils/logging/index.js +16 -0
- package/dist/utils/logging/index.js.map +1 -0
- package/dist/utils/logging/logger.cjs +92 -0
- package/dist/utils/logging/logger.d.ts +70 -0
- package/dist/utils/logging/logger.d.ts.map +1 -0
- package/dist/utils/logging/logger.js +92 -0
- package/dist/utils/logging/logger.js.map +1 -0
- package/dist/utils/url/index.cjs +13 -0
- package/dist/utils/url/index.d.ts +5 -0
- package/dist/utils/url/index.d.ts.map +1 -0
- package/dist/utils/url/index.js +13 -0
- package/dist/utils/url/index.js.map +1 -0
- package/dist/utils/url/url-params.cjs +128 -0
- package/dist/utils/url/url-params.d.ts +36 -0
- package/dist/utils/url/url-params.d.ts.map +1 -0
- package/dist/utils/url/url-params.js +128 -0
- package/dist/utils/url/url-params.js.map +1 -0
- package/dist/utils/validation/index.cjs +25 -0
- package/dist/utils/validation/index.d.ts +5 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +25 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/type-validation.cjs +167 -0
- package/dist/utils/validation/type-validation.d.ts +68 -0
- package/dist/utils/validation/type-validation.d.ts.map +1 -0
- package/dist/utils/validation/type-validation.js +167 -0
- package/dist/utils/validation/type-validation.js.map +1 -0
- package/dist/utils/validation/web3-username-validator.cjs +132 -0
- package/dist/utils/validation/web3-username-validator.d.ts +43 -0
- package/dist/utils/validation/web3-username-validator.d.ts.map +1 -0
- package/dist/utils/validation/web3-username-validator.js +132 -0
- package/dist/utils/validation/web3-username-validator.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Currency formatting utilities for USDC and other tokens
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CLAIM_PERIOD_DAYS = exports.USDC_DECIMALS = void 0;
|
|
7
|
+
exports.formatUSDC = formatUSDC;
|
|
8
|
+
exports.parseUSDC = parseUSDC;
|
|
9
|
+
// USDC configuration constants
|
|
10
|
+
exports.USDC_DECIMALS = 6;
|
|
11
|
+
exports.CLAIM_PERIOD_DAYS = 60;
|
|
12
|
+
/**
|
|
13
|
+
* Format USDC amount from smallest unit to human-readable string
|
|
14
|
+
* @param amount - Amount in smallest USDC units (with 6 decimals)
|
|
15
|
+
* @returns Formatted string with 2 decimal places
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* formatUSDC(1000000) // Returns "1.00"
|
|
19
|
+
* formatUSDC(2500000) // Returns "2.50"
|
|
20
|
+
*/
|
|
21
|
+
function formatUSDC(amount) {
|
|
22
|
+
return (amount / Math.pow(10, exports.USDC_DECIMALS)).toFixed(2);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse USDC amount from human-readable string to smallest unit
|
|
26
|
+
* @param amount - Human-readable amount string
|
|
27
|
+
* @returns Amount in smallest USDC units (with 6 decimals)
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* parseUSDC("1.00") // Returns 1000000
|
|
31
|
+
* parseUSDC("2.50") // Returns 2500000
|
|
32
|
+
*/
|
|
33
|
+
function parseUSDC(amount) {
|
|
34
|
+
return Math.floor(parseFloat(amount) * Math.pow(10, exports.USDC_DECIMALS));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=currency.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Currency formatting utilities for USDC and other tokens
|
|
3
|
+
*/
|
|
4
|
+
export declare const USDC_DECIMALS = 6;
|
|
5
|
+
export declare const CLAIM_PERIOD_DAYS = 60;
|
|
6
|
+
/**
|
|
7
|
+
* Format USDC amount from smallest unit to human-readable string
|
|
8
|
+
* @param amount - Amount in smallest USDC units (with 6 decimals)
|
|
9
|
+
* @returns Formatted string with 2 decimal places
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* formatUSDC(1000000) // Returns "1.00"
|
|
13
|
+
* formatUSDC(2500000) // Returns "2.50"
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatUSDC(amount: number): string;
|
|
16
|
+
/**
|
|
17
|
+
* Parse USDC amount from human-readable string to smallest unit
|
|
18
|
+
* @param amount - Human-readable amount string
|
|
19
|
+
* @returns Amount in smallest USDC units (with 6 decimals)
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* parseUSDC("1.00") // Returns 1000000
|
|
23
|
+
* parseUSDC("2.50") // Returns 2500000
|
|
24
|
+
*/
|
|
25
|
+
export declare function parseUSDC(amount: string): number;
|
|
26
|
+
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/utils/formatting/currency.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Currency formatting utilities for USDC and other tokens
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CLAIM_PERIOD_DAYS = exports.USDC_DECIMALS = void 0;
|
|
7
|
+
exports.formatUSDC = formatUSDC;
|
|
8
|
+
exports.parseUSDC = parseUSDC;
|
|
9
|
+
// USDC configuration constants
|
|
10
|
+
exports.USDC_DECIMALS = 6;
|
|
11
|
+
exports.CLAIM_PERIOD_DAYS = 60;
|
|
12
|
+
/**
|
|
13
|
+
* Format USDC amount from smallest unit to human-readable string
|
|
14
|
+
* @param amount - Amount in smallest USDC units (with 6 decimals)
|
|
15
|
+
* @returns Formatted string with 2 decimal places
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* formatUSDC(1000000) // Returns "1.00"
|
|
19
|
+
* formatUSDC(2500000) // Returns "2.50"
|
|
20
|
+
*/
|
|
21
|
+
function formatUSDC(amount) {
|
|
22
|
+
return (amount / Math.pow(10, exports.USDC_DECIMALS)).toFixed(2);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Parse USDC amount from human-readable string to smallest unit
|
|
26
|
+
* @param amount - Human-readable amount string
|
|
27
|
+
* @returns Amount in smallest USDC units (with 6 decimals)
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* parseUSDC("1.00") // Returns 1000000
|
|
31
|
+
* parseUSDC("2.50") // Returns 2500000
|
|
32
|
+
*/
|
|
33
|
+
function parseUSDC(amount) {
|
|
34
|
+
return Math.floor(parseFloat(amount) * Math.pow(10, exports.USDC_DECIMALS));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=currency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/utils/formatting/currency.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAeH,gCAEC;AAWD,8BAEC;AA5BD,+BAA+B;AAClB,QAAA,aAAa,GAAG,CAAC,CAAC;AAClB,QAAA,iBAAiB,GAAG,EAAE,CAAC;AAEpC;;;;;;;;GAQG;AACH,SAAgB,UAAU,CAAC,MAAc;IACvC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,qBAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,qBAAa,CAAC,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Date formatting utilities
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatEmailDate = formatEmailDate;
|
|
7
|
+
exports.formatTimestamp = formatTimestamp;
|
|
8
|
+
exports.formatRelativeTime = formatRelativeTime;
|
|
9
|
+
exports.parseDate = parseDate;
|
|
10
|
+
exports.isDateInRange = isDateInRange;
|
|
11
|
+
exports.addDays = addDays;
|
|
12
|
+
exports.addHours = addHours;
|
|
13
|
+
/**
|
|
14
|
+
* Format a date for display in email list
|
|
15
|
+
*/
|
|
16
|
+
function formatEmailDate(date) {
|
|
17
|
+
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
|
18
|
+
if (isNaN(dateObj.getTime())) {
|
|
19
|
+
return 'Invalid date';
|
|
20
|
+
}
|
|
21
|
+
const now = new Date();
|
|
22
|
+
const diffMs = now.getTime() - dateObj.getTime();
|
|
23
|
+
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
|
24
|
+
// Today: show time only
|
|
25
|
+
if (diffDays === 0) {
|
|
26
|
+
return dateObj.toLocaleTimeString('en-US', {
|
|
27
|
+
hour: 'numeric',
|
|
28
|
+
minute: '2-digit',
|
|
29
|
+
hour12: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// Yesterday
|
|
33
|
+
if (diffDays === 1) {
|
|
34
|
+
return 'Yesterday';
|
|
35
|
+
}
|
|
36
|
+
// Within a week: show day name
|
|
37
|
+
if (diffDays < 7) {
|
|
38
|
+
return dateObj.toLocaleDateString('en-US', {
|
|
39
|
+
weekday: 'long',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Within this year: show month and day
|
|
43
|
+
if (dateObj.getFullYear() === now.getFullYear()) {
|
|
44
|
+
return dateObj.toLocaleDateString('en-US', {
|
|
45
|
+
month: 'short',
|
|
46
|
+
day: 'numeric',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Different year: show full date
|
|
50
|
+
return dateObj.toLocaleDateString('en-US', {
|
|
51
|
+
year: 'numeric',
|
|
52
|
+
month: 'short',
|
|
53
|
+
day: 'numeric',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Format a timestamp to ISO string
|
|
58
|
+
*/
|
|
59
|
+
function formatTimestamp(timestamp) {
|
|
60
|
+
return new Date(timestamp).toISOString();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Format a date to a relative time string (e.g., "2 hours ago")
|
|
64
|
+
*/
|
|
65
|
+
function formatRelativeTime(date) {
|
|
66
|
+
const dateObj = typeof date === 'string' || typeof date === 'number'
|
|
67
|
+
? new Date(date)
|
|
68
|
+
: date;
|
|
69
|
+
if (isNaN(dateObj.getTime())) {
|
|
70
|
+
return 'Invalid date';
|
|
71
|
+
}
|
|
72
|
+
const now = new Date();
|
|
73
|
+
const diffMs = now.getTime() - dateObj.getTime();
|
|
74
|
+
const diffSeconds = Math.floor(diffMs / 1000);
|
|
75
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
76
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
77
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
78
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
79
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
80
|
+
const diffYears = Math.floor(diffDays / 365);
|
|
81
|
+
if (diffSeconds < 60) {
|
|
82
|
+
return 'just now';
|
|
83
|
+
}
|
|
84
|
+
if (diffMinutes < 60) {
|
|
85
|
+
return diffMinutes === 1 ? '1 minute ago' : `${diffMinutes} minutes ago`;
|
|
86
|
+
}
|
|
87
|
+
if (diffHours < 24) {
|
|
88
|
+
return diffHours === 1 ? '1 hour ago' : `${diffHours} hours ago`;
|
|
89
|
+
}
|
|
90
|
+
if (diffDays < 7) {
|
|
91
|
+
return diffDays === 1 ? '1 day ago' : `${diffDays} days ago`;
|
|
92
|
+
}
|
|
93
|
+
if (diffWeeks < 4) {
|
|
94
|
+
return diffWeeks === 1 ? '1 week ago' : `${diffWeeks} weeks ago`;
|
|
95
|
+
}
|
|
96
|
+
if (diffMonths < 12) {
|
|
97
|
+
return diffMonths === 1 ? '1 month ago' : `${diffMonths} months ago`;
|
|
98
|
+
}
|
|
99
|
+
return diffYears === 1 ? '1 year ago' : `${diffYears} years ago`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Parse a date string safely
|
|
103
|
+
*/
|
|
104
|
+
function parseDate(dateString) {
|
|
105
|
+
try {
|
|
106
|
+
const date = new Date(dateString);
|
|
107
|
+
if (isNaN(date.getTime())) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return date;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if a date is within a range
|
|
118
|
+
*/
|
|
119
|
+
function isDateInRange(date, startDate, endDate) {
|
|
120
|
+
return date >= startDate && date <= endDate;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Add days to a date
|
|
124
|
+
*/
|
|
125
|
+
function addDays(date, days) {
|
|
126
|
+
const result = new Date(date);
|
|
127
|
+
result.setDate(result.getDate() + days);
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Add hours to a date
|
|
132
|
+
*/
|
|
133
|
+
function addHours(date, hours) {
|
|
134
|
+
const result = new Date(date);
|
|
135
|
+
result.setHours(result.getHours() + hours);
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date formatting utilities
|
|
3
|
+
*/
|
|
4
|
+
import { Optional } from '../../types/common';
|
|
5
|
+
/**
|
|
6
|
+
* Format a date for display in email list
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatEmailDate(date: Date | string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Format a timestamp to ISO string
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatTimestamp(timestamp: number): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format a date to a relative time string (e.g., "2 hours ago")
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatRelativeTime(date: Date | string | number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Parse a date string safely
|
|
19
|
+
*/
|
|
20
|
+
export declare function parseDate(dateString: string): Optional<Date>;
|
|
21
|
+
/**
|
|
22
|
+
* Check if a date is within a range
|
|
23
|
+
*/
|
|
24
|
+
export declare function isDateInRange(date: Date, startDate: Date, endDate: Date): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Add days to a date
|
|
27
|
+
*/
|
|
28
|
+
export declare function addDays(date: Date, days: number): Date;
|
|
29
|
+
/**
|
|
30
|
+
* Add hours to a date
|
|
31
|
+
*/
|
|
32
|
+
export declare function addHours(date: Date, hours: number): Date;
|
|
33
|
+
//# sourceMappingURL=date.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../src/utils/formatting/date.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CA8C3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CA6CvE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,CAU5D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,GACZ,OAAO,CAET;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAItD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIxD"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Date formatting utilities
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.formatEmailDate = formatEmailDate;
|
|
7
|
+
exports.formatTimestamp = formatTimestamp;
|
|
8
|
+
exports.formatRelativeTime = formatRelativeTime;
|
|
9
|
+
exports.parseDate = parseDate;
|
|
10
|
+
exports.isDateInRange = isDateInRange;
|
|
11
|
+
exports.addDays = addDays;
|
|
12
|
+
exports.addHours = addHours;
|
|
13
|
+
/**
|
|
14
|
+
* Format a date for display in email list
|
|
15
|
+
*/
|
|
16
|
+
function formatEmailDate(date) {
|
|
17
|
+
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
|
18
|
+
if (isNaN(dateObj.getTime())) {
|
|
19
|
+
return 'Invalid date';
|
|
20
|
+
}
|
|
21
|
+
const now = new Date();
|
|
22
|
+
const diffMs = now.getTime() - dateObj.getTime();
|
|
23
|
+
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
|
|
24
|
+
// Today: show time only
|
|
25
|
+
if (diffDays === 0) {
|
|
26
|
+
return dateObj.toLocaleTimeString('en-US', {
|
|
27
|
+
hour: 'numeric',
|
|
28
|
+
minute: '2-digit',
|
|
29
|
+
hour12: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
// Yesterday
|
|
33
|
+
if (diffDays === 1) {
|
|
34
|
+
return 'Yesterday';
|
|
35
|
+
}
|
|
36
|
+
// Within a week: show day name
|
|
37
|
+
if (diffDays < 7) {
|
|
38
|
+
return dateObj.toLocaleDateString('en-US', {
|
|
39
|
+
weekday: 'long',
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
// Within this year: show month and day
|
|
43
|
+
if (dateObj.getFullYear() === now.getFullYear()) {
|
|
44
|
+
return dateObj.toLocaleDateString('en-US', {
|
|
45
|
+
month: 'short',
|
|
46
|
+
day: 'numeric',
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Different year: show full date
|
|
50
|
+
return dateObj.toLocaleDateString('en-US', {
|
|
51
|
+
year: 'numeric',
|
|
52
|
+
month: 'short',
|
|
53
|
+
day: 'numeric',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Format a timestamp to ISO string
|
|
58
|
+
*/
|
|
59
|
+
function formatTimestamp(timestamp) {
|
|
60
|
+
return new Date(timestamp).toISOString();
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Format a date to a relative time string (e.g., "2 hours ago")
|
|
64
|
+
*/
|
|
65
|
+
function formatRelativeTime(date) {
|
|
66
|
+
const dateObj = typeof date === 'string' || typeof date === 'number'
|
|
67
|
+
? new Date(date)
|
|
68
|
+
: date;
|
|
69
|
+
if (isNaN(dateObj.getTime())) {
|
|
70
|
+
return 'Invalid date';
|
|
71
|
+
}
|
|
72
|
+
const now = new Date();
|
|
73
|
+
const diffMs = now.getTime() - dateObj.getTime();
|
|
74
|
+
const diffSeconds = Math.floor(diffMs / 1000);
|
|
75
|
+
const diffMinutes = Math.floor(diffSeconds / 60);
|
|
76
|
+
const diffHours = Math.floor(diffMinutes / 60);
|
|
77
|
+
const diffDays = Math.floor(diffHours / 24);
|
|
78
|
+
const diffWeeks = Math.floor(diffDays / 7);
|
|
79
|
+
const diffMonths = Math.floor(diffDays / 30);
|
|
80
|
+
const diffYears = Math.floor(diffDays / 365);
|
|
81
|
+
if (diffSeconds < 60) {
|
|
82
|
+
return 'just now';
|
|
83
|
+
}
|
|
84
|
+
if (diffMinutes < 60) {
|
|
85
|
+
return diffMinutes === 1 ? '1 minute ago' : `${diffMinutes} minutes ago`;
|
|
86
|
+
}
|
|
87
|
+
if (diffHours < 24) {
|
|
88
|
+
return diffHours === 1 ? '1 hour ago' : `${diffHours} hours ago`;
|
|
89
|
+
}
|
|
90
|
+
if (diffDays < 7) {
|
|
91
|
+
return diffDays === 1 ? '1 day ago' : `${diffDays} days ago`;
|
|
92
|
+
}
|
|
93
|
+
if (diffWeeks < 4) {
|
|
94
|
+
return diffWeeks === 1 ? '1 week ago' : `${diffWeeks} weeks ago`;
|
|
95
|
+
}
|
|
96
|
+
if (diffMonths < 12) {
|
|
97
|
+
return diffMonths === 1 ? '1 month ago' : `${diffMonths} months ago`;
|
|
98
|
+
}
|
|
99
|
+
return diffYears === 1 ? '1 year ago' : `${diffYears} years ago`;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Parse a date string safely
|
|
103
|
+
*/
|
|
104
|
+
function parseDate(dateString) {
|
|
105
|
+
try {
|
|
106
|
+
const date = new Date(dateString);
|
|
107
|
+
if (isNaN(date.getTime())) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return date;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if a date is within a range
|
|
118
|
+
*/
|
|
119
|
+
function isDateInRange(date, startDate, endDate) {
|
|
120
|
+
return date >= startDate && date <= endDate;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Add days to a date
|
|
124
|
+
*/
|
|
125
|
+
function addDays(date, days) {
|
|
126
|
+
const result = new Date(date);
|
|
127
|
+
result.setDate(result.getDate() + days);
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Add hours to a date
|
|
132
|
+
*/
|
|
133
|
+
function addHours(date, hours) {
|
|
134
|
+
const result = new Date(date);
|
|
135
|
+
result.setHours(result.getHours() + hours);
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=date.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../src/utils/formatting/date.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,0CA8CC;AAKD,0CAEC;AAKD,gDA6CC;AAKD,8BAUC;AAKD,sCAMC;AAKD,0BAIC;AAKD,4BAIC;AAtJD;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAmB;IACjD,MAAM,OAAO,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAEjE,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QAC7B,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG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,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC;IAC3C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncate = exports.toTitleCase = exports.toSnakeCase = exports.toKebabCase = exports.toCamelCase = exports.stripHtml = exports.randomString = exports.pluralize = exports.normalizeWhitespace = exports.isNotBlank = exports.isBlank = exports.getInitials = exports.formatNumber = exports.formatBytes = exports.escapeHtml = exports.capitalize = exports.parseDate = exports.isDateInRange = exports.formatTimestamp = exports.formatRelativeTime = exports.formatEmailDate = exports.addHours = exports.addDays = exports.parseUSDC = exports.formatUSDC = exports.USDC_DECIMALS = exports.CLAIM_PERIOD_DAYS = void 0;
|
|
4
|
+
// Currency formatting
|
|
5
|
+
var currency_1 = require("./currency");
|
|
6
|
+
Object.defineProperty(exports, "CLAIM_PERIOD_DAYS", { enumerable: true, get: function () { return currency_1.CLAIM_PERIOD_DAYS; } });
|
|
7
|
+
Object.defineProperty(exports, "USDC_DECIMALS", { enumerable: true, get: function () { return currency_1.USDC_DECIMALS; } });
|
|
8
|
+
Object.defineProperty(exports, "formatUSDC", { enumerable: true, get: function () { return currency_1.formatUSDC; } });
|
|
9
|
+
Object.defineProperty(exports, "parseUSDC", { enumerable: true, get: function () { return currency_1.parseUSDC; } });
|
|
10
|
+
// Date formatting
|
|
11
|
+
var date_1 = require("./date");
|
|
12
|
+
Object.defineProperty(exports, "addDays", { enumerable: true, get: function () { return date_1.addDays; } });
|
|
13
|
+
Object.defineProperty(exports, "addHours", { enumerable: true, get: function () { return date_1.addHours; } });
|
|
14
|
+
Object.defineProperty(exports, "formatEmailDate", { enumerable: true, get: function () { return date_1.formatEmailDate; } });
|
|
15
|
+
Object.defineProperty(exports, "formatRelativeTime", { enumerable: true, get: function () { return date_1.formatRelativeTime; } });
|
|
16
|
+
Object.defineProperty(exports, "formatTimestamp", { enumerable: true, get: function () { return date_1.formatTimestamp; } });
|
|
17
|
+
Object.defineProperty(exports, "isDateInRange", { enumerable: true, get: function () { return date_1.isDateInRange; } });
|
|
18
|
+
Object.defineProperty(exports, "parseDate", { enumerable: true, get: function () { return date_1.parseDate; } });
|
|
19
|
+
// String formatting
|
|
20
|
+
var string_1 = require("./string");
|
|
21
|
+
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return string_1.capitalize; } });
|
|
22
|
+
Object.defineProperty(exports, "escapeHtml", { enumerable: true, get: function () { return string_1.escapeHtml; } });
|
|
23
|
+
Object.defineProperty(exports, "formatBytes", { enumerable: true, get: function () { return string_1.formatBytes; } });
|
|
24
|
+
Object.defineProperty(exports, "formatNumber", { enumerable: true, get: function () { return string_1.formatNumber; } });
|
|
25
|
+
Object.defineProperty(exports, "getInitials", { enumerable: true, get: function () { return string_1.getInitials; } });
|
|
26
|
+
Object.defineProperty(exports, "isBlank", { enumerable: true, get: function () { return string_1.isBlank; } });
|
|
27
|
+
Object.defineProperty(exports, "isNotBlank", { enumerable: true, get: function () { return string_1.isNotBlank; } });
|
|
28
|
+
Object.defineProperty(exports, "normalizeWhitespace", { enumerable: true, get: function () { return string_1.normalizeWhitespace; } });
|
|
29
|
+
Object.defineProperty(exports, "pluralize", { enumerable: true, get: function () { return string_1.pluralize; } });
|
|
30
|
+
Object.defineProperty(exports, "randomString", { enumerable: true, get: function () { return string_1.randomString; } });
|
|
31
|
+
Object.defineProperty(exports, "stripHtml", { enumerable: true, get: function () { return string_1.stripHtml; } });
|
|
32
|
+
Object.defineProperty(exports, "toCamelCase", { enumerable: true, get: function () { return string_1.toCamelCase; } });
|
|
33
|
+
Object.defineProperty(exports, "toKebabCase", { enumerable: true, get: function () { return string_1.toKebabCase; } });
|
|
34
|
+
Object.defineProperty(exports, "toSnakeCase", { enumerable: true, get: function () { return string_1.toSnakeCase; } });
|
|
35
|
+
Object.defineProperty(exports, "toTitleCase", { enumerable: true, get: function () { return string_1.toTitleCase; } });
|
|
36
|
+
Object.defineProperty(exports, "truncate", { enumerable: true, get: function () { return string_1.truncate; } });
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { CLAIM_PERIOD_DAYS, USDC_DECIMALS, formatUSDC, parseUSDC, } from './currency';
|
|
2
|
+
export { addDays, addHours, formatEmailDate, formatRelativeTime, formatTimestamp, isDateInRange, parseDate, } from './date';
|
|
3
|
+
export { capitalize, escapeHtml, formatBytes, formatNumber, getInitials, isBlank, isNotBlank, normalizeWhitespace, pluralize, randomString, stripHtml, toCamelCase, toKebabCase, toSnakeCase, toTitleCase, truncate, } from './string';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/formatting/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,OAAO,EACP,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,SAAS,GACV,MAAM,QAAQ,CAAC;AAGhB,OAAO,EACL,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,WAAW,EACX,OAAO,EACP,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,SAAS,EACT,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,QAAQ,GACT,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.truncate = exports.toTitleCase = exports.toSnakeCase = exports.toKebabCase = exports.toCamelCase = exports.stripHtml = exports.randomString = exports.pluralize = exports.normalizeWhitespace = exports.isNotBlank = exports.isBlank = exports.getInitials = exports.formatNumber = exports.formatBytes = exports.escapeHtml = exports.capitalize = exports.parseDate = exports.isDateInRange = exports.formatTimestamp = exports.formatRelativeTime = exports.formatEmailDate = exports.addHours = exports.addDays = exports.parseUSDC = exports.formatUSDC = exports.USDC_DECIMALS = exports.CLAIM_PERIOD_DAYS = void 0;
|
|
4
|
+
// Currency formatting
|
|
5
|
+
var currency_1 = require("./currency");
|
|
6
|
+
Object.defineProperty(exports, "CLAIM_PERIOD_DAYS", { enumerable: true, get: function () { return currency_1.CLAIM_PERIOD_DAYS; } });
|
|
7
|
+
Object.defineProperty(exports, "USDC_DECIMALS", { enumerable: true, get: function () { return currency_1.USDC_DECIMALS; } });
|
|
8
|
+
Object.defineProperty(exports, "formatUSDC", { enumerable: true, get: function () { return currency_1.formatUSDC; } });
|
|
9
|
+
Object.defineProperty(exports, "parseUSDC", { enumerable: true, get: function () { return currency_1.parseUSDC; } });
|
|
10
|
+
// Date formatting
|
|
11
|
+
var date_1 = require("./date");
|
|
12
|
+
Object.defineProperty(exports, "addDays", { enumerable: true, get: function () { return date_1.addDays; } });
|
|
13
|
+
Object.defineProperty(exports, "addHours", { enumerable: true, get: function () { return date_1.addHours; } });
|
|
14
|
+
Object.defineProperty(exports, "formatEmailDate", { enumerable: true, get: function () { return date_1.formatEmailDate; } });
|
|
15
|
+
Object.defineProperty(exports, "formatRelativeTime", { enumerable: true, get: function () { return date_1.formatRelativeTime; } });
|
|
16
|
+
Object.defineProperty(exports, "formatTimestamp", { enumerable: true, get: function () { return date_1.formatTimestamp; } });
|
|
17
|
+
Object.defineProperty(exports, "isDateInRange", { enumerable: true, get: function () { return date_1.isDateInRange; } });
|
|
18
|
+
Object.defineProperty(exports, "parseDate", { enumerable: true, get: function () { return date_1.parseDate; } });
|
|
19
|
+
// String formatting
|
|
20
|
+
var string_1 = require("./string");
|
|
21
|
+
Object.defineProperty(exports, "capitalize", { enumerable: true, get: function () { return string_1.capitalize; } });
|
|
22
|
+
Object.defineProperty(exports, "escapeHtml", { enumerable: true, get: function () { return string_1.escapeHtml; } });
|
|
23
|
+
Object.defineProperty(exports, "formatBytes", { enumerable: true, get: function () { return string_1.formatBytes; } });
|
|
24
|
+
Object.defineProperty(exports, "formatNumber", { enumerable: true, get: function () { return string_1.formatNumber; } });
|
|
25
|
+
Object.defineProperty(exports, "getInitials", { enumerable: true, get: function () { return string_1.getInitials; } });
|
|
26
|
+
Object.defineProperty(exports, "isBlank", { enumerable: true, get: function () { return string_1.isBlank; } });
|
|
27
|
+
Object.defineProperty(exports, "isNotBlank", { enumerable: true, get: function () { return string_1.isNotBlank; } });
|
|
28
|
+
Object.defineProperty(exports, "normalizeWhitespace", { enumerable: true, get: function () { return string_1.normalizeWhitespace; } });
|
|
29
|
+
Object.defineProperty(exports, "pluralize", { enumerable: true, get: function () { return string_1.pluralize; } });
|
|
30
|
+
Object.defineProperty(exports, "randomString", { enumerable: true, get: function () { return string_1.randomString; } });
|
|
31
|
+
Object.defineProperty(exports, "stripHtml", { enumerable: true, get: function () { return string_1.stripHtml; } });
|
|
32
|
+
Object.defineProperty(exports, "toCamelCase", { enumerable: true, get: function () { return string_1.toCamelCase; } });
|
|
33
|
+
Object.defineProperty(exports, "toKebabCase", { enumerable: true, get: function () { return string_1.toKebabCase; } });
|
|
34
|
+
Object.defineProperty(exports, "toSnakeCase", { enumerable: true, get: function () { return string_1.toSnakeCase; } });
|
|
35
|
+
Object.defineProperty(exports, "toTitleCase", { enumerable: true, get: function () { return string_1.toTitleCase; } });
|
|
36
|
+
Object.defineProperty(exports, "truncate", { enumerable: true, get: function () { return string_1.truncate; } });
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/formatting/index.ts"],"names":[],"mappings":";;;AAAA,sBAAsB;AACtB,uCAKoB;AAJlB,6GAAA,iBAAiB,OAAA;AACjB,yGAAA,aAAa,OAAA;AACb,sGAAA,UAAU,OAAA;AACV,qGAAA,SAAS,OAAA;AAGX,kBAAkB;AAClB,+BAQgB;AAPd,+FAAA,OAAO,OAAA;AACP,gGAAA,QAAQ,OAAA;AACR,uGAAA,eAAe,OAAA;AACf,0GAAA,kBAAkB,OAAA;AAClB,uGAAA,eAAe,OAAA;AACf,qGAAA,aAAa,OAAA;AACb,iGAAA,SAAS,OAAA;AAGX,oBAAoB;AACpB,mCAiBkB;AAhBhB,oGAAA,UAAU,OAAA;AACV,oGAAA,UAAU,OAAA;AACV,qGAAA,WAAW,OAAA;AACX,sGAAA,YAAY,OAAA;AACZ,qGAAA,WAAW,OAAA;AACX,iGAAA,OAAO,OAAA;AACP,oGAAA,UAAU,OAAA;AACV,6GAAA,mBAAmB,OAAA;AACnB,mGAAA,SAAS,OAAA;AACT,sGAAA,YAAY,OAAA;AACZ,mGAAA,SAAS,OAAA;AACT,qGAAA,WAAW,OAAA;AACX,qGAAA,WAAW,OAAA;AACX,qGAAA,WAAW,OAAA;AACX,qGAAA,WAAW,OAAA;AACX,kGAAA,QAAQ,OAAA"}
|