@rtorcato/js-common 1.3.0 → 1.4.0

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 (111) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +22 -0
  3. package/package.json +2 -2
  4. package/dist/abortController/index.d.ts +0 -29
  5. package/dist/abortController/index.d.ts.map +0 -1
  6. package/dist/arrays/index.d.ts +0 -44
  7. package/dist/arrays/index.d.ts.map +0 -1
  8. package/dist/boolean/index.d.ts +0 -41
  9. package/dist/boolean/index.d.ts.map +0 -1
  10. package/dist/colors/index.d.ts +0 -63
  11. package/dist/colors/index.d.ts.map +0 -1
  12. package/dist/console/index.d.ts +0 -16
  13. package/dist/console/index.d.ts.map +0 -1
  14. package/dist/crypto/index.d.ts +0 -34
  15. package/dist/crypto/index.d.ts.map +0 -1
  16. package/dist/currency/currencies.d.ts +0 -16
  17. package/dist/currency/currencies.d.ts.map +0 -1
  18. package/dist/currency/index.d.ts +0 -52
  19. package/dist/currency/index.d.ts.map +0 -1
  20. package/dist/date/index.d.ts +0 -44
  21. package/dist/date/index.d.ts.map +0 -1
  22. package/dist/datetime/index.d.ts +0 -52
  23. package/dist/datetime/index.d.ts.map +0 -1
  24. package/dist/emails/banned/index.d.ts +0 -9
  25. package/dist/emails/banned/index.d.ts.map +0 -1
  26. package/dist/emails/index.d.ts +0 -26
  27. package/dist/emails/index.d.ts.map +0 -1
  28. package/dist/env/index.d.ts +0 -63
  29. package/dist/env/index.d.ts.map +0 -1
  30. package/dist/errors/index.d.ts +0 -39
  31. package/dist/errors/index.d.ts.map +0 -1
  32. package/dist/events/index.d.ts +0 -35
  33. package/dist/events/index.d.ts.map +0 -1
  34. package/dist/fetch/index.d.ts +0 -38
  35. package/dist/fetch/index.d.ts.map +0 -1
  36. package/dist/file/index.d.ts +0 -32
  37. package/dist/file/index.d.ts.map +0 -1
  38. package/dist/formatting/index.d.ts +0 -52
  39. package/dist/formatting/index.d.ts.map +0 -1
  40. package/dist/functions/index.d.ts +0 -33
  41. package/dist/functions/index.d.ts.map +0 -1
  42. package/dist/geometry/index.d.ts +0 -58
  43. package/dist/geometry/index.d.ts.map +0 -1
  44. package/dist/html/index.d.ts +0 -31
  45. package/dist/html/index.d.ts.map +0 -1
  46. package/dist/i18n/index.d.ts +0 -37
  47. package/dist/i18n/index.d.ts.map +0 -1
  48. package/dist/index.d.ts +0 -3
  49. package/dist/index.d.ts.map +0 -1
  50. package/dist/interval/index.d.ts +0 -13
  51. package/dist/interval/index.d.ts.map +0 -1
  52. package/dist/json/index.d.ts +0 -28
  53. package/dist/json/index.d.ts.map +0 -1
  54. package/dist/logger/logger.d.ts +0 -3
  55. package/dist/logger/logger.d.ts.map +0 -1
  56. package/dist/logging/index.d.ts +0 -28
  57. package/dist/logging/index.d.ts.map +0 -1
  58. package/dist/logging/index1.d.ts +0 -33
  59. package/dist/logging/index1.d.ts.map +0 -1
  60. package/dist/maps/index.d.ts +0 -32
  61. package/dist/maps/index.d.ts.map +0 -1
  62. package/dist/math/index.d.ts +0 -3
  63. package/dist/math/index.d.ts.map +0 -1
  64. package/dist/math/math.d.ts +0 -37
  65. package/dist/math/math.d.ts.map +0 -1
  66. package/dist/math/sum/index.d.ts +0 -3
  67. package/dist/math/sum/index.d.ts.map +0 -1
  68. package/dist/mime-types/db.d.ts +0 -4605
  69. package/dist/mime-types/db.d.ts.map +0 -1
  70. package/dist/mime-types/index.d.ts +0 -25
  71. package/dist/mime-types/index.d.ts.map +0 -1
  72. package/dist/node/index.d.ts +0 -52
  73. package/dist/node/index.d.ts.map +0 -1
  74. package/dist/numbers/index.d.ts +0 -74
  75. package/dist/numbers/index.d.ts.map +0 -1
  76. package/dist/obects/index.d.ts +0 -34
  77. package/dist/obects/index.d.ts.map +0 -1
  78. package/dist/os/index.d.ts +0 -26
  79. package/dist/os/index.d.ts.map +0 -1
  80. package/dist/process/index.d.ts +0 -31
  81. package/dist/process/index.d.ts.map +0 -1
  82. package/dist/promises/index.d.ts +0 -39
  83. package/dist/promises/index.d.ts.map +0 -1
  84. package/dist/random/index.d.ts +0 -33
  85. package/dist/random/index.d.ts.map +0 -1
  86. package/dist/regex/index.d.ts +0 -36
  87. package/dist/regex/index.d.ts.map +0 -1
  88. package/dist/security/index.d.ts +0 -14
  89. package/dist/security/index.d.ts.map +0 -1
  90. package/dist/sets/index.d.ts +0 -48
  91. package/dist/sets/index.d.ts.map +0 -1
  92. package/dist/sleep/index.d.ts +0 -27
  93. package/dist/sleep/index.d.ts.map +0 -1
  94. package/dist/strings/index.d.ts +0 -74
  95. package/dist/strings/index.d.ts.map +0 -1
  96. package/dist/system/index.d.ts +0 -36
  97. package/dist/system/index.d.ts.map +0 -1
  98. package/dist/time/index.d.ts +0 -36
  99. package/dist/time/index.d.ts.map +0 -1
  100. package/dist/try/attempt.d.ts +0 -8
  101. package/dist/try/attempt.d.ts.map +0 -1
  102. package/dist/try/index.d.ts +0 -2
  103. package/dist/try/index.d.ts.map +0 -1
  104. package/dist/try/trycatch.d.ts +0 -12
  105. package/dist/try/trycatch.d.ts.map +0 -1
  106. package/dist/url/index.d.ts +0 -40
  107. package/dist/url/index.d.ts.map +0 -1
  108. package/dist/uuid/index.d.ts +0 -40
  109. package/dist/uuid/index.d.ts.map +0 -1
  110. package/dist/validation/index.d.ts +0 -49
  111. package/dist/validation/index.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.4.0](https://github.com/rtorcato/js-common/compare/v1.3.1...v1.4.0) (2025-10-24)
2
+
3
+
4
+ ### Features
5
+
6
+ * Enable TypeScript type definitions for package consumers ([70eb162](https://github.com/rtorcato/js-common/commit/70eb162bb556164432762f382470ff28a3ec0251))
7
+
8
+ ## [1.3.1](https://github.com/rtorcato/js-common/compare/v1.3.0...v1.3.1) (2025-10-24)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Correct import paths in CLI for proper TypeScript compilation ([24221d5](https://github.com/rtorcato/js-common/commit/24221d5622fa70dabe78166c7266c825686466ab))
14
+
1
15
  # [1.3.0](https://github.com/rtorcato/js-common/compare/v1.2.0...v1.3.0) (2025-10-24)
2
16
 
3
17
 
package/README.md CHANGED
@@ -76,6 +76,28 @@ import { today } from '@rtorcato/js-common/date'
76
76
  import { sum, average } from '@rtorcato/js-common/numbers'
77
77
  ```
78
78
 
79
+ ### 🎯 **TypeScript Support**
80
+
81
+ This package is built with TypeScript and includes complete type definitions out of the box:
82
+
83
+ - ✅ **Full type safety** - All functions have accurate TypeScript types
84
+ - ✅ **Generic support** - Functions like `unique<T>()` preserve your data types
85
+ - ✅ **JSDoc integration** - Rich documentation in your IDE
86
+ - ✅ **Tree-shakable** - Import only what you need with perfect type inference
87
+
88
+ ```typescript
89
+ // TypeScript automatically infers types
90
+ const numbers = [1, 2, 3, 4, 5]
91
+ const result: number = sum(numbers) // ✅ Type: number
92
+
93
+ const users = [{ name: 'John' }, { name: 'Jane' }]
94
+ const uniqueUsers = unique(users) // ✅ Type: { name: string }[]
95
+
96
+ // IDE shows full documentation and type hints
97
+ import { today } from '@rtorcato/js-common/date'
98
+ // ^ JSDoc: Returns today's date as YYYY-MM-DD string
99
+ ```
100
+
79
101
  ## Available Modules
80
102
 
81
103
  ### 📅 **Date & Time**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtorcato/js-common",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "JavaScript and TypeScript common code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "build-dev": "rimraf ./dist && cross-env NODE_ENV=development node build.mjs && tsc --emitDeclarationOnly --project tsconfig.build.json && npm run build-cli",
30
30
  "build-prod": "rimraf ./dist && cross-env NODE_ENV=production node build.mjs && tsc --emitDeclarationOnly --project tsconfig.build.json && npm run build-cli",
31
31
  "build-cli": "tsc src/cli/cli.ts --outDir dist/cli --target ES2022 --module ES2022 --moduleResolution bundler --allowImportingTsExtensions false --esModuleInterop --skipLibCheck && mv dist/cli/cli.js dist/cli/temp.mjs && echo '#!/usr/bin/env node' > dist/cli/index.mjs && cat dist/cli/temp.mjs >> dist/cli/index.mjs && rm dist/cli/temp.mjs && chmod +x dist/cli/index.mjs",
32
- "prepublishOnly1": "npm run build-prod",
32
+ "prepublishOnly": "npm run build-prod",
33
33
  "==================== Common ====================": "",
34
34
  "lint": "pnpm exec biome lint .",
35
35
  "format": "pnpm exec biome format .",
@@ -1,29 +0,0 @@
1
- /**
2
- * Creates a new AbortController and returns its controller and signal.
3
- * @returns {{ controller: AbortController, signal: AbortSignal }}
4
- */
5
- export declare function createAbortController(): {
6
- controller: AbortController;
7
- signal: AbortSignal;
8
- };
9
- /**
10
- * Returns a promise that rejects when the given AbortSignal is aborted.
11
- * @param signal The AbortSignal to listen to.
12
- * @returns {Promise<never>}
13
- */
14
- export declare function abortPromise(signal: AbortSignal): Promise<never>;
15
- /**
16
- * Wraps a promise and rejects it if the signal is aborted.
17
- * @param promise The promise to wrap.
18
- * @param signal The AbortSignal.
19
- * @returns {Promise<T>}
20
- */
21
- export declare function withAbort<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>;
22
- /**
23
- * Aborts the given controller after a timeout (ms).
24
- * @param controller The AbortController.
25
- * @param ms Timeout in milliseconds.
26
- * @returns {NodeJS.Timeout | number} The timeout ID.
27
- */
28
- export declare function abortAfter(controller: AbortController, ms: number): ReturnType<typeof setTimeout>;
29
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abortController/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,qBAAqB;;;EAGpC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,CAchE;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAEjG"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Returns the first element of an array, or undefined if the array is empty.
3
- * @param arr The array.
4
- * @returns The first element or undefined.
5
- */
6
- export declare function first<T>(arr: T[]): T | undefined;
7
- /**
8
- * Returns the last element of an array, or undefined if the array is empty.
9
- * @param arr The array.
10
- * @returns The last element or undefined.
11
- */
12
- export declare function last<T>(arr: T[]): T | undefined;
13
- /**
14
- * Removes duplicate values from an array.
15
- * @param arr The array.
16
- * @returns A new array with unique values.
17
- */
18
- export declare function unique<T>(arr: T[]): T[];
19
- /**
20
- * Flattens an array one level deep.
21
- * @param arr The array to flatten.
22
- * @returns A new flattened array.
23
- */
24
- export declare function flatten<T>(arr: any[]): T[];
25
- /**
26
- * Chunks an array into smaller arrays of a specified size.
27
- * @param arr The array to chunk.
28
- * @param size The chunk size.
29
- * @returns An array of chunks.
30
- */
31
- export declare function chunk<T>(arr: T[], size: number): T[][];
32
- /**
33
- * Removes all falsy values from an array.
34
- * @param arr The array.
35
- * @returns A new array with only truthy values.
36
- */
37
- export declare function compact<T>(arr: T[]): T[];
38
- /**
39
- * Shuffles an array in place using the Fisher-Yates algorithm.
40
- * @param arr The array to shuffle.
41
- * @returns The shuffled array.
42
- */
43
- export declare function shuffle<T>(arr: T[]): T[];
44
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/arrays/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEvC;AAED;;;;GAIG;AAEH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAE1C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAMtD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAExC;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAOxC"}
@@ -1,41 +0,0 @@
1
- /**
2
- * Converts a value to a boolean.
3
- * Accepts 'true', '1', 1 as true; 'false', '0', 0 as false.
4
- * @param value The value to convert.
5
- * @returns The boolean representation.
6
- */
7
- export declare function toBoolean(value: any): boolean;
8
- /**
9
- * Checks if a value is a boolean.
10
- * @param value The value to check.
11
- * @returns True if the value is a boolean, false otherwise.
12
- */
13
- export declare function isBoolean(value: any): value is boolean;
14
- /**
15
- * Returns the logical exclusive OR (XOR) of two booleans.
16
- * @param a First boolean.
17
- * @param b Second boolean.
18
- * @returns True if exactly one of a or b is true.
19
- */
20
- export declare function xor(a: boolean, b: boolean): boolean;
21
- /**
22
- * Logical AND for two booleans.
23
- * @param a First boolean.
24
- * @param b Second boolean.
25
- * @returns True if both a and b are true.
26
- */
27
- export declare function and(a: boolean, b: boolean): boolean;
28
- /**
29
- * Logical OR for two booleans.
30
- * @param a First boolean.
31
- * @param b Second boolean.
32
- * @returns True if either a or b is true.
33
- */
34
- export declare function or(a: boolean, b: boolean): boolean;
35
- /**
36
- * Logical NOT for a boolean.
37
- * @param a The boolean to negate.
38
- * @returns The negated boolean.
39
- */
40
- export declare function not(a: boolean): boolean;
41
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/boolean/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAW7C;AAED;;;;GAIG;AAEH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,OAAO,CAEtD;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAEnD;AAED;;;;;GAKG;AACH,wBAAgB,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAElD;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,OAAO,CAEvC"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Generates a random hex color string.
3
- *
4
- * @returns {string} A string representing a random color in hexadecimal format (e.g., `#a1b2c3`).
5
- */
6
- export declare function randomColor(): string;
7
- /**
8
- * Generates a random color with a given alpha value.
9
- *
10
- * @export
11
- * @param {string} color
12
- * @return {*}
13
- */
14
- export declare function matchingTextColor(color: string): "#000" | "#fff";
15
- /**
16
- * Converts a hex color string to an RGB object.
17
- *
18
- * @export
19
- * @param {string} hex
20
- * @return {*} {({ r: number; g: number; b: number } | null)}
21
- */
22
- export declare function hexToRgb(hex: string): {
23
- r: number;
24
- g: number;
25
- b: number;
26
- } | null;
27
- /**
28
- * Converts RGB values to a hex color string.
29
- *
30
- * @export
31
- * @param {number} r
32
- * @param {number} g
33
- * @param {number} b
34
- * @return {*} {string}
35
- */
36
- export declare function rgbToHex(r: number, g: number, b: number): string;
37
- /**
38
- * Converts a hex color string to an HSL object.
39
- *
40
- * @export
41
- * @param {string} hex
42
- * @return {*} {({ h: number; s: number; l: number } | null)}
43
- */
44
- export declare function isValidHex(hex: string): boolean;
45
- /**
46
- * Darkens a hex color by a given percentage.
47
- *
48
- * @export
49
- * @param {string} hex
50
- * @param {number} percent
51
- * @return {*} {string}
52
- */
53
- export declare function darken(hex: string, percent: number): string;
54
- /**
55
- * Lightens a hex color by a given percentage.
56
- *
57
- * @export
58
- * @param {string} hex
59
- * @param {number} percent
60
- * @return {*} {string}
61
- */
62
- export declare function lighten(hex: string, percent: number): string;
63
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/colors/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAKpC;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,mBAO9C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQhF;AAED;;;;;;;;GAQG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAOhE;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO5D"}
@@ -1,16 +0,0 @@
1
- /**
2
- * @fileoverview Console utility functions for logging and disabling console output in production.
3
- * @module console
4
- */
5
- /**
6
- * Disables console output in production environment.
7
- */
8
- export declare const disableConsole: () => void;
9
- /**
10
- * Clears the console.
11
- *
12
- * @export
13
- * @return {*} {void}
14
- */
15
- export declare const clearConsole: () => void;
16
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/console/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,YAK1B,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAA"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Hashes a string using the specified algorithm.
3
- * @param str The string to hash.
4
- * @param algorithm The hash algorithm (default: 'sha256').
5
- * @returns The hex-encoded hash.
6
- */
7
- export declare function hashString(str: string, algorithm?: string): string;
8
- /**
9
- * Generates a random hex string of the specified length (in bytes).
10
- * @param length The number of bytes (not hex chars).
11
- * @returns A random hex string.
12
- */
13
- export declare function randomHex(length?: number): string;
14
- /**
15
- * Creates an HMAC hash of a string using a secret and algorithm.
16
- * @param str The string to hash.
17
- * @param secret The secret key.
18
- * @param algorithm The hash algorithm (default: 'sha256').
19
- * @returns The hex-encoded HMAC.
20
- */
21
- export declare function hmacHash(str: string, secret: string, algorithm?: string): string;
22
- /**
23
- * Encodes a string to base64.
24
- * @param str The string to encode.
25
- * @returns The base64-encoded string.
26
- */
27
- export declare function base64Encode(str: string): string;
28
- /**
29
- * Decodes a base64 string.
30
- * @param b64 The base64 string to decode.
31
- * @returns The decoded string.
32
- */
33
- export declare function base64Decode(b64: string): string;
34
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,SAAW,GAAG,MAAM,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAK,GAAG,MAAM,CAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,SAAW,GAAG,MAAM,CAElF;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD"}
@@ -1,16 +0,0 @@
1
- /**
2
- * List of supported currency codes.
3
- *
4
- * This array contains ISO 4217 currency codes and some special codes
5
- * (such as precious metals and testing codes) used in financial applications.
6
- *
7
- * @remarks
8
- * - Some codes represent fiat currencies (e.g., 'USD', 'EUR').
9
- * - Some codes represent precious metals (e.g., 'XAU' for gold).
10
- * - Some codes are reserved for testing or special purposes (e.g., 'XTS', 'XXX').
11
- *
12
- * @see {@link https://www.iso.org/iso-4217-currency-codes.html ISO 4217 Currency Codes}
13
- */
14
- export declare const currencies: string[];
15
- export default currencies;
16
- //# sourceMappingURL=currencies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"currencies.d.ts","sourceRoot":"","sources":["../../src/currency/currencies.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,UAAU,UA6CtB,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Returns the currency symbol for a given ISO 4217 currency code.
3
- *
4
- * Utilizes the `Intl.NumberFormat` API to format a number as currency and extract the symbol.
5
- *
6
- * @param currency - The ISO 4217 currency code (e.g., 'USD', 'EUR', 'JPY').
7
- * @returns The currency symbol as a string (e.g., '$', '€', '¥'), or `undefined` if the symbol cannot be determined.
8
- */
9
- export declare const getCurrencySymbol: (currency: string) => string | undefined;
10
- /**
11
- * Formats a given price value into a localized currency string.
12
- *
13
- * @param price - The numeric value or string representation of the price to format.
14
- * @param currency - The currency code to use for formatting. Supported values are 'USD', 'EUR', 'GBP', and 'BDT'. Defaults to 'USD'.
15
- * @param notation - The formatting notation style. Can be 'compact', 'engineering', 'scientific', or 'standard'. Defaults to 'standard'.
16
- * @returns The formatted currency string according to the specified locale, currency, and notation.
17
- */
18
- export declare function formatPrice(price: number | string, currency?: 'USD' | 'EUR' | 'GBP' | 'BDT', notation?: 'compact' | 'engineering' | 'scientific' | 'standard'): string;
19
- /**
20
- * Parses a given price string and returns its numeric value.
21
- *
22
- * @param value - The price string to parse.
23
- * @returns The numeric value of the price, or `null` if the value cannot be parsed.
24
- */
25
- export declare function parsePrice(value: string): number | null;
26
- /**
27
- * Converts a given amount from one currency to another using the provided exchange rate.
28
- *
29
- * @param amount - The amount of money to convert.
30
- * @param rate - The exchange rate to use for the conversion.
31
- * @param decimals - The number of decimal places to include in the result. Defaults to 2.
32
- * @returns The converted amount as a number.
33
- */
34
- export declare function convertCurrency(amount: number, rate: number, decimals?: number): number;
35
- /**
36
- * Checks if the provided currency code is valid.
37
- *
38
- * Converts the input code to uppercase and verifies if it exists in the list of supported currencies.
39
- *
40
- * @param code - The currency code to validate (e.g., 'USD', 'eur').
41
- * @returns `true` if the currency code is valid; otherwise, `false`.
42
- */
43
- export declare function isValidCurrencyCode(code: string): boolean;
44
- /**
45
- * Rounds a given number to a specified number of decimal places.
46
- *
47
- * @param value - The number to be rounded.
48
- * @param decimals - The number of decimal places to round to. Defaults to 2.
49
- * @returns The rounded number.
50
- */
51
- export declare function roundTo(value: number, decimals?: number): number;
52
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/currency/index.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,KAAG,MAAM,GAAG,SAQ7D,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,QAAQ,GAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAa,EAC/C,QAAQ,GAAE,SAAS,GAAG,aAAa,GAAG,YAAY,GAAG,UAAuB,UAO5E;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAIvD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAElF;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAG3D"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Returns today's date as a YYYY-MM-DD string.
3
- * @returns {string}
4
- */
5
- export declare function today(): string;
6
- /**
7
- * Returns a Date object from a YYYY-MM-DD string.
8
- * @param dateStr The date string.
9
- * @returns {Date}
10
- */
11
- export declare function parseDate(dateStr: string): Date;
12
- /**
13
- * Formats a Date object as YYYY-MM-DD.
14
- * @param date The Date object.
15
- * @returns {string}
16
- */
17
- export declare function formatDate(date: Date): string;
18
- /**
19
- * Returns the difference in days between two dates (date2 - date1).
20
- * @param date1 The first date (string or Date).
21
- * @param date2 The second date (string or Date).
22
- * @returns {number}
23
- */
24
- export declare function daysBetween(date1: string | Date, date2: string | Date): number;
25
- /**
26
- * Checks if a year is a leap year.
27
- * @param year The year (number or Date).
28
- * @returns {boolean}
29
- */
30
- export declare function isLeapYear(year: number | Date): boolean;
31
- /**
32
- * Adds days to a date and returns a new Date object.
33
- * @param date The date (string or Date).
34
- * @param days Number of days to add.
35
- * @returns {Date}
36
- */
37
- export declare function addDays(date: string | Date, days: number): Date;
38
- /**
39
- * Returns the day of the week for a date (0=Sunday, 6=Saturday).
40
- * @param date The date (string or Date).
41
- * @returns {number}
42
- */
43
- export declare function getDayOfWeek(date: string | Date): number;
44
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/date/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,KAAK,IAAI,MAAM,CAG9B;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAI9E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAGvD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAI/D;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAGxD"}
@@ -1,52 +0,0 @@
1
- /**
2
- * Returns the current date and time as an ISO string (YYYY-MM-DDTHH:mm:ss.sssZ).
3
- */
4
- export declare function nowIso(): string;
5
- /**
6
- * Parses an ISO date-time string to a Date object. Returns null if invalid.
7
- * @param iso The ISO string.
8
- */
9
- export declare function parseIsoDateTime(iso: string): Date | null;
10
- /**
11
- * Formats a Date as YYYY-MM-DD HH:mm:ss (local time).
12
- * @param date The Date object.
13
- */
14
- export declare function formatDateTimeLocal(date: Date): string;
15
- /**
16
- * Returns the timezone offset in minutes for a given date (local - UTC).
17
- * @param date The Date object.
18
- */
19
- export declare function getTimezoneOffset(date?: Date): number;
20
- /**
21
- * Returns the UTC equivalent of a local Date.
22
- * @param date The local Date object.
23
- */
24
- export declare function toUtcDate(date: Date): Date;
25
- /**
26
- * Returns the number of seconds since the Unix epoch (UTC).
27
- */
28
- export declare function unixTimestamp(): number;
29
- /**
30
- * Returns the number of milliseconds since the Unix epoch.
31
- */
32
- export declare function unixMillis(): number;
33
- /**
34
- * Returns the difference in seconds between two Date objects.
35
- * @param a First date.
36
- * @param b Second date.
37
- */
38
- export declare function secondsBetween(a: Date, b: Date): number;
39
- /**
40
- * Returns the ISO week number (1–53) of a given date using UTC.
41
- * @param date A JavaScript Date object.
42
- */
43
- export declare function getIsoWeek(date: Date): number;
44
- /**
45
- * Returns ISO week number and ISO week year (which may differ from calendar year).
46
- * @param date Date object (UTC-safe)
47
- */
48
- export declare function getIsoWeekInfo(date: Date): {
49
- week: number;
50
- year: number;
51
- };
52
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/datetime/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,MAAM,IAAI,MAAM,CAE/B;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAGzD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAMtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,IAAiB,GAAG,MAAM,CAEjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAY1C;AAED;;GAEG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;GAEG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAoB7C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAmBzE"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Checks if the domain part of the given email is present in a list of forbidden domains.
3
- *
4
- * @param email - The email address to check.
5
- * @param forbiddenEmails - A newline-separated string of forbidden email domains.
6
- * @throws Will throw an error if the email is not formatted properly or if the domain is forbidden.
7
- */
8
- export declare const isEmailinBannedDomains: (email: string, forbiddenEmails: string) => void;
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/emails/banned/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,EAAE,iBAAiB,MAAM,SAW5E,CAAA"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Validates if a string is a valid email address (simple regex).
3
- * @param email The email address to validate.
4
- * @returns True if valid, false otherwise.
5
- */
6
- export declare function isValidEmail(email: string): boolean;
7
- /**
8
- * Normalizes an email address by trimming and converting to lowercase.
9
- * @param email The email address to normalize.
10
- * @returns The normalized email address.
11
- */
12
- export declare function normalizeEmail(email: string): string;
13
- /**
14
- * Masks an email address for privacy (e.g., j***@domain.com).
15
- * @param email The email address to mask.
16
- * @returns The masked email address.
17
- */
18
- export declare function maskEmail(email: string): string;
19
- /**
20
- * Extracts the domain from an email address.
21
- * @param email The email address.
22
- * @returns The domain part of the email, or an empty string if invalid.
23
- */
24
- export declare function getEmailDomain(email: string): string;
25
- export declare function isFreeEmailProvider(email: string): boolean;
26
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/emails/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAE1D"}
@@ -1,63 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Retrieves the value of an environment variable by its key.
4
- *
5
- * @param key - The name of the environment variable to retrieve.
6
- * @param defaultValue - An optional default value to return if the environment variable is not defined.
7
- * @returns The value of the environment variable if it exists, otherwise the default value if provided.
8
- * @throws {Error} If the environment variable is undefined and no default value is provided.
9
- */
10
- export declare const getENV: (key: string, defaultValue?: string) => string;
11
- /**
12
- * Determines if the current environment is set to development.
13
- *
14
- * @returns {boolean} `true` if `process.env.NODE_ENV` is `'development'`, otherwise `false`.
15
- */
16
- export declare const isDev: () => boolean;
17
- /**
18
- * Determines if the current environment is set to production.
19
- *
20
- * @returns {boolean} `true` if `process.env.NODE_ENV` is `'production'`, otherwise `false`.
21
- */
22
- export declare const isProd: () => boolean;
23
- /**
24
- * Determines if the current environment is set to test.
25
- *
26
- * @returns {boolean} `true` if `process.env.NODE_ENV` is `'test'`, otherwise `false`.
27
- */
28
- export declare const isTest: () => boolean;
29
- /**
30
- * Returns the current NODE_ENV value, or 'development' if not set.
31
- *
32
- * @returns {string}
33
- */
34
- export declare const getNodeEnv: () => string;
35
- /**
36
- *
37
- * Validates the environment variables against a Zod schema.
38
- * Throws an error if any required variables are missing or invalid.
39
- * @param {z.ZodObject<T>} EnvSchema - The Zod schema to validate against.
40
- * @param {Record<string, string | undefined>} buildEnv - The environment variables to validate, defaults to `process.env`.
41
- * @throws {Error} If validation fails, an error with a message listing missing variables is thrown.
42
- */
43
- export declare function checkEnv<T extends z.ZodRawShape>(EnvSchema: z.ZodObject<T>, buildEnv?: Record<string, string | undefined>): z.core.$InferObjectOutput<T, {}>;
44
- /**
45
- * Schema for validating the root environment variables.
46
- * It includes NODE_ENV, LOG_LEVEL, and PORT with their respective types and defaults.
47
- */
48
- export declare const RootApiEnvSchema: z.ZodObject<{
49
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
50
- test: "test";
51
- development: "development";
52
- production: "production";
53
- }>>;
54
- LOG_LEVEL: z.ZodDefault<z.ZodEnum<{
55
- debug: "debug";
56
- info: "info";
57
- warn: "warn";
58
- error: "error";
59
- }>>;
60
- PORT: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
61
- }, z.core.$strip>;
62
- export type RootApiEnvSchema = z.infer<typeof RootApiEnvSchema>;
63
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/env/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,KAAK,MAAM,EAAE,eAAe,MAAM,WAUxD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK,QAAO,OAExB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAO,OAEzB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAO,OAEzB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,QAAO,MAE7B,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAC/C,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EACzB,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,oCAc1D;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;iBAI3B,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA"}