@rtorcato/js-common 1.8.1 → 2.0.1

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 (118) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +77 -62
  3. package/dist/abortController/index.d.ts +29 -0
  4. package/dist/abortController/index.d.ts.map +1 -0
  5. package/dist/arrays/index.d.ts +134 -0
  6. package/dist/arrays/index.d.ts.map +1 -0
  7. package/dist/arrays/index.js +1 -1
  8. package/dist/boolean/index.d.ts +41 -0
  9. package/dist/boolean/index.d.ts.map +1 -0
  10. package/dist/boolean/index.js +1 -1
  11. package/dist/colors/index.d.ts +63 -0
  12. package/dist/colors/index.d.ts.map +1 -0
  13. package/dist/console/index.d.ts +16 -0
  14. package/dist/console/index.d.ts.map +1 -0
  15. package/dist/crypto/index.d.ts +34 -0
  16. package/dist/crypto/index.d.ts.map +1 -0
  17. package/dist/currency/currencies.d.ts +16 -0
  18. package/dist/currency/currencies.d.ts.map +1 -0
  19. package/dist/currency/index.d.ts +170 -0
  20. package/dist/currency/index.d.ts.map +1 -0
  21. package/dist/date/index.d.ts +44 -0
  22. package/dist/date/index.d.ts.map +1 -0
  23. package/dist/datetime/index.d.ts +52 -0
  24. package/dist/datetime/index.d.ts.map +1 -0
  25. package/dist/emails/banned/index.d.ts +9 -0
  26. package/dist/emails/banned/index.d.ts.map +1 -0
  27. package/dist/emails/index.d.ts +26 -0
  28. package/dist/emails/index.d.ts.map +1 -0
  29. package/dist/env/index.d.ts +63 -0
  30. package/dist/env/index.d.ts.map +1 -0
  31. package/dist/errors/index.d.ts +39 -0
  32. package/dist/errors/index.d.ts.map +1 -0
  33. package/dist/errors/index.js +1 -1
  34. package/dist/events/index.d.ts +35 -0
  35. package/dist/events/index.d.ts.map +1 -0
  36. package/dist/fetch/index.d.ts +38 -0
  37. package/dist/fetch/index.d.ts.map +1 -0
  38. package/dist/file/index.d.ts +32 -0
  39. package/dist/file/index.d.ts.map +1 -0
  40. package/dist/formatting/index.d.ts +40 -0
  41. package/dist/formatting/index.d.ts.map +1 -0
  42. package/dist/functions/index.d.ts +33 -0
  43. package/dist/functions/index.d.ts.map +1 -0
  44. package/dist/geometry/index.d.ts +58 -0
  45. package/dist/geometry/index.d.ts.map +1 -0
  46. package/dist/html/index.d.ts +31 -0
  47. package/dist/html/index.d.ts.map +1 -0
  48. package/dist/i18n/index.d.ts +37 -0
  49. package/dist/i18n/index.d.ts.map +1 -0
  50. package/dist/index.d.ts +2 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/interval/index.d.ts +13 -0
  53. package/dist/interval/index.d.ts.map +1 -0
  54. package/dist/json/index.d.ts +28 -0
  55. package/dist/json/index.d.ts.map +1 -0
  56. package/dist/logger/index.d.ts +2 -0
  57. package/dist/logger/index.d.ts.map +1 -0
  58. package/dist/logger/logger.d.ts +3 -0
  59. package/dist/logger/logger.d.ts.map +1 -0
  60. package/dist/logging/index.d.ts +29 -0
  61. package/dist/logging/index.d.ts.map +1 -0
  62. package/dist/logging/index.js +1 -1
  63. package/dist/maps/index.d.ts +32 -0
  64. package/dist/maps/index.d.ts.map +1 -0
  65. package/dist/math/index.d.ts +37 -0
  66. package/dist/math/index.d.ts.map +1 -0
  67. package/dist/math/index.js +1 -1
  68. package/dist/mime-types/db.d.ts +4605 -0
  69. package/dist/mime-types/db.d.ts.map +1 -0
  70. package/dist/mime-types/index.d.ts +25 -0
  71. package/dist/mime-types/index.d.ts.map +1 -0
  72. package/dist/node/index.d.ts +52 -0
  73. package/dist/node/index.d.ts.map +1 -0
  74. package/dist/numbers/index.d.ts +82 -0
  75. package/dist/numbers/index.d.ts.map +1 -0
  76. package/dist/objects/index.d.ts +35 -0
  77. package/dist/objects/index.d.ts.map +1 -0
  78. package/dist/os/index.d.ts +26 -0
  79. package/dist/os/index.d.ts.map +1 -0
  80. package/dist/process/index.d.ts +31 -0
  81. package/dist/process/index.d.ts.map +1 -0
  82. package/dist/promises/index.d.ts +39 -0
  83. package/dist/promises/index.d.ts.map +1 -0
  84. package/dist/random/index.d.ts +33 -0
  85. package/dist/random/index.d.ts.map +1 -0
  86. package/dist/regex/index.d.ts +36 -0
  87. package/dist/regex/index.d.ts.map +1 -0
  88. package/dist/security/index.d.ts +14 -0
  89. package/dist/security/index.d.ts.map +1 -0
  90. package/dist/sets/index.d.ts +48 -0
  91. package/dist/sets/index.d.ts.map +1 -0
  92. package/dist/sleep/index.d.ts +27 -0
  93. package/dist/sleep/index.d.ts.map +1 -0
  94. package/dist/strings/index.d.ts +296 -0
  95. package/dist/strings/index.d.ts.map +1 -0
  96. package/dist/system/index.d.ts +36 -0
  97. package/dist/system/index.d.ts.map +1 -0
  98. package/dist/time/index.d.ts +36 -0
  99. package/dist/time/index.d.ts.map +1 -0
  100. package/dist/try/attempt.d.ts +8 -0
  101. package/dist/try/attempt.d.ts.map +1 -0
  102. package/dist/try/index.d.ts +2 -0
  103. package/dist/try/index.d.ts.map +1 -0
  104. package/dist/try/trycatch.d.ts +12 -0
  105. package/dist/try/trycatch.d.ts.map +1 -0
  106. package/dist/types/common/index.d.ts +9 -0
  107. package/dist/types/env.d.ts +5 -0
  108. package/dist/types/index.d.ts +3 -0
  109. package/dist/url/index.d.ts +40 -0
  110. package/dist/url/index.d.ts.map +1 -0
  111. package/dist/uuid/index.d.ts +99 -0
  112. package/dist/uuid/index.d.ts.map +1 -0
  113. package/dist/validation/index.d.ts +49 -0
  114. package/dist/validation/index.d.ts.map +1 -0
  115. package/dist/validation/index.js +1 -1
  116. package/package.json +3 -16
  117. package/dist/chunks/chunk-DCFILRIS.js +0 -1
  118. package/dist/math/math.js +0 -1
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Calculates the distance between two points in 2D space.
3
+ * @param x1 X coordinate of first point.
4
+ * @param y1 Y coordinate of first point.
5
+ * @param x2 X coordinate of second point.
6
+ * @param y2 Y coordinate of second point.
7
+ * @returns {number} The distance.
8
+ */
9
+ export declare function distance2D(x1: number, y1: number, x2: number, y2: number): number;
10
+ /**
11
+ * Calculates the midpoint between two points in 2D space.
12
+ * @param x1 X coordinate of first point.
13
+ * @param y1 Y coordinate of first point.
14
+ * @param x2 X coordinate of second point.
15
+ * @param y2 Y coordinate of second point.
16
+ * @returns {[number, number]} The midpoint as [x, y].
17
+ */
18
+ export declare function midpoint2D(x1: number, y1: number, x2: number, y2: number): [number, number];
19
+ /**
20
+ * Calculates the angle (in radians) between two points in 2D space.
21
+ * @param x1 X coordinate of first point.
22
+ * @param y1 Y coordinate of first point.
23
+ * @param x2 X coordinate of second point.
24
+ * @param y2 Y coordinate of second point.
25
+ * @returns {number} The angle in radians.
26
+ */
27
+ export declare function angle2D(x1: number, y1: number, x2: number, y2: number): number;
28
+ /**
29
+ * Checks if a point is inside a rectangle.
30
+ * @param px X coordinate of the point.
31
+ * @param py Y coordinate of the point.
32
+ * @param rx X coordinate of the rectangle's top-left corner.
33
+ * @param ry Y coordinate of the rectangle's top-left corner.
34
+ * @param rw Rectangle width.
35
+ * @param rh Rectangle height.
36
+ * @returns {boolean} True if inside, false otherwise.
37
+ */
38
+ export declare function pointInRect(px: number, py: number, rx: number, ry: number, rw: number, rh: number): boolean;
39
+ /**
40
+ * Checks if two rectangles overlap.
41
+ * @param ax X of rect A.
42
+ * @param ay Y of rect A.
43
+ * @param aw Width of rect A.
44
+ * @param ah Height of rect A.
45
+ * @param bx X of rect B.
46
+ * @param by Y of rect B.
47
+ * @param bw Width of rect B.
48
+ * @param bh Height of rect B.
49
+ * @returns {boolean} True if rectangles overlap.
50
+ */
51
+ export declare function rectsOverlap(ax: number, ay: number, aw: number, ah: number, bx: number, by: number, bw: number, bh: number): boolean;
52
+ /**
53
+ * Calculates the area of a polygon given its vertices (Shoelace formula).
54
+ * @param points Array of [x, y] pairs.
55
+ * @returns {number} The area (positive value).
56
+ */
57
+ export declare function polygonArea(points: [number, number][]): number;
58
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geometry/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAE3F;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAE9E;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAC1B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACR,OAAO,CAET;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAC3B,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,EACV,EAAE,EAAE,MAAM,GACR,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,MAAM,CAY9D"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Escapes special HTML characters in a string to prevent XSS attacks.
3
+ * @param str The string to escape.
4
+ * @returns The escaped string.
5
+ */
6
+ export declare function escapeHtml(str: string): string;
7
+ /**
8
+ * Unescapes HTML entities in a string.
9
+ * @param str The string to unescape.
10
+ * @returns The unescaped string.
11
+ */
12
+ export declare function unescapeHtml(str: string): string;
13
+ /**
14
+ * Strips all HTML tags from a string.
15
+ * @param str The string to strip tags from.
16
+ * @returns The plain text string.
17
+ */
18
+ export declare function stripHtmlTags(str: string): string;
19
+ /**
20
+ * Converts a plain text string to a simple HTML paragraph (\n to <br>).
21
+ * @param str The plain text string.
22
+ * @returns The HTML string with <br> tags.
23
+ */
24
+ export declare function textToHtml(str: string): string;
25
+ /**
26
+ * Checks if a string contains any HTML tags.
27
+ * @param str The string to check.
28
+ * @returns True if the string contains HTML tags, false otherwise.
29
+ */
30
+ export declare function containsHtml(str: string): boolean;
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/html/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAOhD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEjD"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Detects the user's preferred language from the browser or Node.js environment.
3
+ * @returns {string} The language code (e.g., 'en', 'fr').
4
+ */
5
+ export declare function detectLanguage(defaultLang?: string): string;
6
+ /**
7
+ * Formats a number as a localized string.
8
+ * @param value The number to format.
9
+ * @param locale The locale code (e.g., 'en-US').
10
+ * @param options Intl.NumberFormat options.
11
+ * @returns {string}
12
+ */
13
+ export declare function formatNumber(value: number, locale?: string, options?: Intl.NumberFormatOptions): string;
14
+ /**
15
+ * Formats a date as a localized string.
16
+ * @param date The date to format.
17
+ * @param locale The locale code (e.g., 'en-US').
18
+ * @param options Intl.DateTimeFormat options.
19
+ * @returns {string}
20
+ */
21
+ export declare function formatDateI18n(date: Date, locale?: string, options?: Intl.DateTimeFormatOptions): string;
22
+ /**
23
+ * Simple translation function using a dictionary object.
24
+ * @param key The translation key.
25
+ * @param dict The dictionary object (e.g., { en: { hello: 'Hello' }, fr: { hello: 'Bonjour' } }).
26
+ * @param lang The language code (optional, defaults to detected language).
27
+ * @returns {string}
28
+ */
29
+ export declare function t(key: string, dict: Record<string, Record<string, string>>, lang?: string): string;
30
+ /**
31
+ * Pluralizes a word based on a count (basic English only).
32
+ * @param word The word to pluralize.
33
+ * @param count The count.
34
+ * @returns {string}
35
+ */
36
+ export declare function pluralize(word: string, count: number): string;
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,WAAW,GAAE,MAAa,GAAG,MAAM,CAQjE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,GAChC,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC7B,IAAI,EAAE,IAAI,EACV,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GAClC,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,CAAC,CAChB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC5C,IAAI,CAAC,EAAE,MAAM,GACX,MAAM,CAGR;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAA"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Runs a function repeatedly at a specified interval (cross-platform).
3
+ * @param fn The function to run.
4
+ * @param ms The interval in milliseconds.
5
+ * @returns The interval ID (NodeJS.Timeout or number).
6
+ */
7
+ export declare function runInterval(fn: () => void, ms: number): ReturnType<typeof setInterval>;
8
+ /**
9
+ * Cancels an interval by its ID (cross-platform).
10
+ * @param id The interval ID (NodeJS.Timeout or number).
11
+ */
12
+ export declare function clearIntervalById(id: ReturnType<typeof setInterval>): void;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interval/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAEtF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,IAAI,CAE1E"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Safely parses a JSON string, returning a fallback value if parsing fails.
3
+ * @param {string} str - The JSON string to parse.
4
+ * @param {any} [fallback=null] - The value to return if parsing fails.
5
+ * @returns The parsed object or the fallback value.
6
+ */
7
+ export declare function safeJsonParse<T = any>(str: string, fallback?: T | null): T | null;
8
+ /**
9
+ * Safely stringifies a value to JSON, returning a fallback value if stringification fails.
10
+ * @param {any} value - The value to stringify.
11
+ * @param {string} [fallback=null] - The value to return if stringification fails.
12
+ * @returns The JSON string or the fallback value.
13
+ */
14
+ export declare function safeJsonStringify(value: any, fallback?: string | null): string | null;
15
+ /**
16
+ * Checks if a string is valid JSON.
17
+ * @param {string} str - The string to check.
18
+ * @returns {boolean} True if the string is valid JSON, false otherwise.
19
+ */
20
+ export declare function isValidJson(str: string): boolean;
21
+ /**
22
+ * Deep clones a value using JSON serialization.
23
+ * Note: Only works for JSON-safe values (no functions, undefined, etc).
24
+ * @param {T} value - The value to clone.
25
+ * @returns {T} The deep-cloned value.
26
+ */
27
+ export declare function deepCloneJson<T>(value: T): T;
28
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/json/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,CAAC,GAAG,IAAW,GAAG,CAAC,GAAG,IAAI,CAMvF;AAED;;;;;GAKG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,GAAE,MAAM,GAAG,IAAW,GAAG,MAAM,GAAG,IAAI,CAM3F;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOhD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAE5C"}
@@ -0,0 +1,2 @@
1
+ export { logger } from './logger';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,3 @@
1
+ import pino from 'pino';
2
+ export declare const logger: pino.Logger<never, boolean>;
3
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB,eAAO,MAAM,MAAM,6BAyBO,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Logs a message with a timestamp.
3
+ * @param message The message to log.
4
+ * @param level The log level (default: 'info').
5
+ */
6
+ export declare function logWithTimestamp(message: string, level?: 'info' | 'warn' | 'error'): void;
7
+ /**
8
+ * Logs a warning message.
9
+ * @param message The warning message.
10
+ */
11
+ export declare function warn(message: string): void;
12
+ /**
13
+ * Logs an error message.
14
+ * @param message The error message.
15
+ */
16
+ export declare function error(message: string): void;
17
+ /**
18
+ * Logs an info message.
19
+ * @param message The info message.
20
+ */
21
+ export declare function info(message: string): void;
22
+ /**
23
+ * Captures all console output and returns a function to restore it.
24
+ * @param callback Function to call with each log message.
25
+ * @returns {() => void} Restore function.
26
+ */
27
+ export type ConsoleLevel = 'log' | 'info' | 'warn' | 'error';
28
+ export declare function captureConsole(callback: (type: ConsoleLevel, ...args: unknown[]) => void): () => void;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logging/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAM,GAAG,MAAM,GAAG,OAAgB,GAAG,IAAI,CAIjG;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG3C;AAED;;;GAGG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG1C;AAED;;;;GAIG;AAEH,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5D,wBAAgB,cAAc,CAC7B,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,GACxD,MAAM,IAAI,CAgBZ"}
@@ -1 +1 @@
1
- import"../chunks/chunk-ANN5UYCF.js";function e(o,r="info"){let n=new Date().toISOString();console[r](`[${n}] ${o}`)}function t(o){console.warn(`[WARN] ${o}`)}function s(o){console.error(`[ERROR] ${o}`)}function c(o){console.info(`[INFO] ${o}`)}function l(o){let r={log:console.log,info:console.info,warn:console.warn,error:console.error};return["log","info","warn","error"].forEach(n=>{console[n]=(...i)=>{o(n,...i),r[n](...i)}}),()=>{Object.assign(console,r)}}export{l as captureConsole,s as error,c as info,e as logWithTimestamp,t as warn};
1
+ import"../chunks/chunk-ANN5UYCF.js";function i(o,r="info"){let n=new Date().toISOString();console[r](`[${n}] ${o}`)}function t(o){console.warn(`[WARN] ${o}`)}function s(o){console.error(`[ERROR] ${o}`)}function c(o){console.info(`[INFO] ${o}`)}function l(o){let r={log:console.log,info:console.info,warn:console.warn,error:console.error};return["log","info","warn","error"].forEach(n=>{console[n]=(...e)=>{o(n,...e),r[n](...e)}}),()=>{Object.assign(console,r)}}export{l as captureConsole,s as error,c as info,i as logWithTimestamp,t as warn};
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Inverts a Map (swaps keys and values). If duplicate values exist, later keys overwrite earlier ones.
3
+ * @param map The map to invert.
4
+ * @returns {Map<any, any>} The inverted map.
5
+ */
6
+ export declare function invertMap<K, V>(map: Map<K, V>): Map<V, K>;
7
+ /**
8
+ * Maps the values of a Map using a function.
9
+ * @param map The map to map over.
10
+ * @param fn The function to apply to each value.
11
+ * @returns {Map<K, U>} A new map with mapped values.
12
+ */
13
+ export declare function mapValues<K, V, U>(map: Map<K, V>, fn: (value: V, key: K) => U): Map<K, U>;
14
+ /**
15
+ * Merges two or more maps. Later maps overwrite earlier keys.
16
+ * @param maps The maps to merge.
17
+ * @returns {Map<K, V>} The merged map.
18
+ */
19
+ export declare function mergeMaps<K, V>(...maps: Map<K, V>[]): Map<K, V>;
20
+ /**
21
+ * Converts an object to a Map.
22
+ * @param obj The object to convert.
23
+ * @returns {Map<string, any>} The resulting map.
24
+ */
25
+ export declare function objectToMap<T extends object>(obj: T): Map<string, any>;
26
+ /**
27
+ * Converts a Map to an object.
28
+ * @param map The map to convert.
29
+ * @returns {Record<string, any>} The resulting object.
30
+ */
31
+ export declare function mapToObject<V>(map: Map<string, V>): Record<string, V>;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/maps/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAMzD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAMzF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAQ/D;AAED;;;;GAIG;AAEH,wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAMrE"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Add two numbers.
3
+ * For example, 1 + 2 = 3.
4
+ *
5
+ * @param {number} a
6
+ * @param {number} b
7
+ * @returns {number} number
8
+ */
9
+ export declare const add: (a: number, b: number) => number;
10
+ /**
11
+ * Subtract two numbers.
12
+ * For example, 2 - 1 = 1.
13
+ *
14
+ * @param {number} a
15
+ * @param {number} b
16
+ * @returns {number} number
17
+ */
18
+ export declare const subtract: (a: number, b: number) => number;
19
+ /**
20
+ * Multiply two numbers.
21
+ * For example, 2 * 2 = 4.
22
+ *
23
+ * @param {number} a
24
+ * @param {number} b
25
+ * @returns {number} number
26
+ */
27
+ export declare const multiply: (a: number, b: number) => number;
28
+ /**
29
+ * Divide two numbers.
30
+ * For example, 4 / 2 = 2.
31
+ *
32
+ * @param {number} a
33
+ * @param {number} b
34
+ * @returns {number} number
35
+ */
36
+ export declare const divide: (a: number, b: number) => number;
37
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAAe,CAAA;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAAe,CAAA;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAAe,CAAA;AAE/D;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,KAAG,MAAe,CAAA"}
@@ -1 +1 @@
1
- import{a as d,b as t,c as i,d as r}from"../chunks/chunk-DCFILRIS.js";import"../chunks/chunk-ANN5UYCF.js";export{d as add,r as divide,i as multiply,t as subtract};
1
+ import"../chunks/chunk-ANN5UYCF.js";var n=(e,r)=>e+r,u=(e,r)=>e-r,b=(e,r)=>e*r,m=(e,r)=>e/r;export{n as add,m as divide,b as multiply,u as subtract};