@rtorcato/js-common 1.2.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.
- package/CHANGELOG.md +32 -0
- package/CONTRIBUTORS.md +97 -0
- package/LICENSE +21 -0
- package/README.md +199 -0
- package/dist/abortController/index.d.ts +29 -0
- package/dist/abortController/index.d.ts.map +1 -0
- package/dist/abortController/index.js +1 -0
- package/dist/arrays/index.d.ts +44 -0
- package/dist/arrays/index.d.ts.map +1 -0
- package/dist/arrays/index.js +1 -0
- package/dist/boolean/index.d.ts +41 -0
- package/dist/boolean/index.d.ts.map +1 -0
- package/dist/boolean/index.js +1 -0
- package/dist/chunks/chunk-7MXMG6WN.js +1 -0
- package/dist/chunks/chunk-ANN5UYCF.js +1 -0
- package/dist/chunks/chunk-DCFILRIS.js +1 -0
- package/dist/chunks/chunk-W72HFHZY.js +1 -0
- package/dist/chunks/chunk-XAQ7VMV4.js +1 -0
- package/dist/cli/index.cjs +3711 -0
- package/dist/colors/index.d.ts +63 -0
- package/dist/colors/index.d.ts.map +1 -0
- package/dist/colors/index.js +1 -0
- package/dist/console/index.d.ts +16 -0
- package/dist/console/index.d.ts.map +1 -0
- package/dist/console/index.js +1 -0
- package/dist/crypto/index.d.ts +34 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +1 -0
- package/dist/currency/currencies.d.ts +16 -0
- package/dist/currency/currencies.d.ts.map +1 -0
- package/dist/currency/currencies.js +1 -0
- package/dist/currency/index.d.ts +52 -0
- package/dist/currency/index.d.ts.map +1 -0
- package/dist/currency/index.js +1 -0
- package/dist/date/index.d.ts +44 -0
- package/dist/date/index.d.ts.map +1 -0
- package/dist/date/index.js +1 -0
- package/dist/datetime/index.d.ts +52 -0
- package/dist/datetime/index.d.ts.map +1 -0
- package/dist/datetime/index.js +1 -0
- package/dist/emails/banned/index.d.ts +9 -0
- package/dist/emails/banned/index.d.ts.map +1 -0
- package/dist/emails/index.d.ts +26 -0
- package/dist/emails/index.d.ts.map +1 -0
- package/dist/emails/index.js +1 -0
- package/dist/env/index.d.ts +63 -0
- package/dist/env/index.d.ts.map +1 -0
- package/dist/env/index.js +3 -0
- package/dist/errors/index.d.ts +39 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/events/index.d.ts +35 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +1 -0
- package/dist/fetch/index.d.ts +38 -0
- package/dist/fetch/index.d.ts.map +1 -0
- package/dist/fetch/index.js +1 -0
- package/dist/file/index.d.ts +32 -0
- package/dist/file/index.d.ts.map +1 -0
- package/dist/file/index.js +1 -0
- package/dist/formatting/index.d.ts +52 -0
- package/dist/formatting/index.d.ts.map +1 -0
- package/dist/formatting/index.js +1 -0
- package/dist/functions/index.d.ts +33 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/functions/index.js +1 -0
- package/dist/geometry/index.d.ts +58 -0
- package/dist/geometry/index.d.ts.map +1 -0
- package/dist/geometry/index.js +1 -0
- package/dist/html/index.d.ts +31 -0
- package/dist/html/index.d.ts.map +1 -0
- package/dist/html/index.js +1 -0
- package/dist/i18n/index.d.ts +37 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/interval/index.d.ts +13 -0
- package/dist/interval/index.d.ts.map +1 -0
- package/dist/interval/index.js +1 -0
- package/dist/json/index.d.ts +28 -0
- package/dist/json/index.d.ts.map +1 -0
- package/dist/json/index.js +1 -0
- package/dist/logger/logger.d.ts +3 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logging/index.d.ts +28 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +1 -0
- package/dist/logging/index1.d.ts +33 -0
- package/dist/logging/index1.d.ts.map +1 -0
- package/dist/logging/index1.js +1 -0
- package/dist/maps/index.d.ts +32 -0
- package/dist/maps/index.d.ts.map +1 -0
- package/dist/maps/index.js +1 -0
- package/dist/math/index.d.ts +3 -0
- package/dist/math/index.d.ts.map +1 -0
- package/dist/math/index.js +1 -0
- package/dist/math/math.d.ts +37 -0
- package/dist/math/math.d.ts.map +1 -0
- package/dist/math/math.js +1 -0
- package/dist/math/sum/index.d.ts +3 -0
- package/dist/math/sum/index.d.ts.map +1 -0
- package/dist/mime-types/db.d.ts +4605 -0
- package/dist/mime-types/db.d.ts.map +1 -0
- package/dist/mime-types/db.js +1 -0
- package/dist/mime-types/index.d.ts +25 -0
- package/dist/mime-types/index.d.ts.map +1 -0
- package/dist/mime-types/index.js +7 -0
- package/dist/node/index.d.ts +52 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +1 -0
- package/dist/numbers/index.d.ts +74 -0
- package/dist/numbers/index.d.ts.map +1 -0
- package/dist/numbers/index.js +1 -0
- package/dist/obects/index.d.ts +34 -0
- package/dist/obects/index.d.ts.map +1 -0
- package/dist/obects/index.js +1 -0
- package/dist/os/index.d.ts +26 -0
- package/dist/os/index.d.ts.map +1 -0
- package/dist/os/index.js +1 -0
- package/dist/process/index.d.ts +31 -0
- package/dist/process/index.d.ts.map +1 -0
- package/dist/process/index.js +1 -0
- package/dist/promises/index.d.ts +39 -0
- package/dist/promises/index.d.ts.map +1 -0
- package/dist/promises/index.js +1 -0
- package/dist/random/index.d.ts +33 -0
- package/dist/random/index.d.ts.map +1 -0
- package/dist/random/index.js +1 -0
- package/dist/regex/index.d.ts +36 -0
- package/dist/regex/index.d.ts.map +1 -0
- package/dist/regex/index.js +1 -0
- package/dist/security/index.d.ts +14 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +1 -0
- package/dist/sets/index.d.ts +48 -0
- package/dist/sets/index.d.ts.map +1 -0
- package/dist/sets/index.js +1 -0
- package/dist/sleep/index.d.ts +27 -0
- package/dist/sleep/index.d.ts.map +1 -0
- package/dist/sleep/index.js +1 -0
- package/dist/strings/index.d.ts +74 -0
- package/dist/strings/index.d.ts.map +1 -0
- package/dist/strings/index.js +1 -0
- package/dist/system/index.d.ts +36 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/system/index.js +1 -0
- package/dist/time/index.d.ts +36 -0
- package/dist/time/index.d.ts.map +1 -0
- package/dist/time/index.js +1 -0
- package/dist/try/attempt.d.ts +8 -0
- package/dist/try/attempt.d.ts.map +1 -0
- package/dist/try/attempt.js +1 -0
- package/dist/try/index.d.ts +2 -0
- package/dist/try/index.d.ts.map +1 -0
- package/dist/try/index.js +1 -0
- package/dist/try/trycatch.d.ts +12 -0
- package/dist/try/trycatch.d.ts.map +1 -0
- package/dist/try/trycatch.js +1 -0
- package/dist/url/index.d.ts +40 -0
- package/dist/url/index.d.ts.map +1 -0
- package/dist/url/index.js +1 -0
- package/dist/uuid/index.d.ts +40 -0
- package/dist/uuid/index.d.ts.map +1 -0
- package/dist/uuid/index.js +1 -0
- package/dist/validation/index.d.ts +49 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +1 -0
- package/package.json +290 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/file/index.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAExE;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAErF;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEzD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";import{promises as i}from"node:fs";import*as r from"node:path";async function s(t){return await i.readFile(t,"utf-8")}async function o(t,e){await i.writeFile(t,e,"utf-8")}async function a(t){try{return await i.access(t),!0}catch{return!1}}async function c(t){await i.unlink(t)}function u(t){return r.extname(t)}export{c as deleteFile,a as fileExists,u as getFileExtension,s as readFileAsString,o as writeFileAsString};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pads a string or number with leading zeros to a given length.
|
|
3
|
+
* @param value The value to pad.
|
|
4
|
+
* @param length The desired length.
|
|
5
|
+
* @returns The padded string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function padZero(value: string | number, length?: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Capitalizes the first character of a string.
|
|
10
|
+
* @param str The string to capitalize.
|
|
11
|
+
* @returns The capitalized string.
|
|
12
|
+
*/
|
|
13
|
+
export declare function capitalize(str: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Converts a string to title case (first letter of each word capitalized).
|
|
16
|
+
* @param str The string to convert.
|
|
17
|
+
* @returns The title-cased string.
|
|
18
|
+
*/
|
|
19
|
+
export declare function toTitleCase(str: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Formats a number with thousands separators.
|
|
22
|
+
* @param num The number to format.
|
|
23
|
+
* @param locale Optional locale string (default: 'en-US').
|
|
24
|
+
* @returns The formatted string.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatNumber(num: number, locale?: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Formats a number as a percentage string.
|
|
29
|
+
* @param value The value to format (e.g. 0.25 for 25%).
|
|
30
|
+
* @param fractionDigits Number of decimal places (default: 0).
|
|
31
|
+
* @returns The formatted percentage string.
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatPercent(value: number, fractionDigits?: number): string;
|
|
34
|
+
/**
|
|
35
|
+
* Formats a Date as YYYY-MM-DD.
|
|
36
|
+
* @param date The date to format.
|
|
37
|
+
* @returns The formatted date string.
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatDate(date: Date): string;
|
|
40
|
+
/**
|
|
41
|
+
* Formats a Date as HH:MM:SS.
|
|
42
|
+
* @param date The date to format.
|
|
43
|
+
* @returns The formatted time string.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatTime(date: Date): string;
|
|
46
|
+
/**
|
|
47
|
+
* Formats a Date as YYYY-MM-DD HH:MM:SS.
|
|
48
|
+
* @param date The date to format.
|
|
49
|
+
* @returns The formatted date-time string.
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatDateTime(date: Date): string;
|
|
52
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/formatting/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,MAAgB,GAAG,MAAM,CAE1E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,SAAI,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAEjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function e(t,r=2){return String(t).padStart(r,"0")}function i(t){return t?t[0]?.toUpperCase()+t.slice(1):""}function u(t){return t.replace(/\w\S*/g,r=>(r[0]?.toUpperCase()??"")+r.slice(1).toLowerCase())}function g(t,r="en-US"){return t.toLocaleString(r)}function s(t,r=0){return`${(t*100).toFixed(r)}%`}function n(t){return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}`}function o(t){return`${e(t.getHours())}:${e(t.getMinutes())}:${e(t.getSeconds())}`}function a(t){return`${n(t)} ${o(t)}`}export{i as capitalize,n as formatDate,a as formatDateTime,g as formatNumber,s as formatPercent,o as formatTime,e as padZero,u as toTitleCase};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a function that only calls the original function once.
|
|
3
|
+
* @param fn The function to wrap.
|
|
4
|
+
* @returns {Function}
|
|
5
|
+
*/
|
|
6
|
+
export declare function once<T extends (...args: any[]) => any>(fn: T): T;
|
|
7
|
+
/**
|
|
8
|
+
* Returns a debounced version of a function.
|
|
9
|
+
* @param fn The function to debounce.
|
|
10
|
+
* @param wait Milliseconds to wait.
|
|
11
|
+
* @returns {Function}
|
|
12
|
+
*/
|
|
13
|
+
export declare function debounce<T extends (...args: any[]) => void>(fn: T, wait: number): T;
|
|
14
|
+
/**
|
|
15
|
+
* Returns a throttled version of a function.
|
|
16
|
+
* @param fn The function to throttle.
|
|
17
|
+
* @param wait Milliseconds to wait between calls.
|
|
18
|
+
* @returns {Function}
|
|
19
|
+
*/
|
|
20
|
+
export declare function throttle<T extends (...args: any[]) => void>(fn: T, wait: number): T;
|
|
21
|
+
/**
|
|
22
|
+
* Composes functions from right to left.
|
|
23
|
+
* @param fns Functions to compose.
|
|
24
|
+
* @returns {Function}
|
|
25
|
+
*/
|
|
26
|
+
export declare function compose<T>(...fns: Array<(arg: T) => T>): (arg: T) => T;
|
|
27
|
+
/**
|
|
28
|
+
* Pipes functions from left to right.
|
|
29
|
+
* @param fns Functions to pipe.
|
|
30
|
+
* @returns {Function}
|
|
31
|
+
*/
|
|
32
|
+
export declare function pipe<T>(...fns: Array<(arg: T) => T>): (arg: T) => T;
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/functions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,IAAI,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAUhE;AAED;;;;;GAKG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAMnF;AAED;;;;;GAKG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CASnF;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAEnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function o(n){let t=!1,e;return function(...r){return t||(t=!0,e=n.apply(this,r)),e}}function T(n,t){let e;return function(...r){clearTimeout(e),e=setTimeout(()=>n.apply(this,r),t)}}function u(n,t){let e=0;return function(...r){let a=Date.now();a-e>=t&&(e=a,n.apply(this,r))}}function i(...n){return t=>n.reduceRight((e,r)=>r(e),t)}function s(...n){return t=>n.reduce((e,r)=>r(e),t)}export{i as compose,T as debounce,o as once,s as pipe,u as throttle};
|
|
@@ -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 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function a(n,r,u,e){return Math.hypot(u-n,e-r)}function p(n,r,u,e){return[(n+u)/2,(r+e)/2]}function f(n,r,u,e){return Math.atan2(e-r,u-n)}function l(n,r,u,e,t,b){return n>=u&&n<=u+t&&r>=e&&r<=e+b}function s(n,r,u,e,t,b,m,o){return n<t+m&&n+u>t&&r<b+o&&r+e>b}function h(n){let r=0,u=n.length;for(let e=0;e<u;e++){let t=n[e],b=n[(e+1)%u];if(!t||!b)continue;let[m,o]=t,[c,i]=b;r+=m*i-c*o}return Math.abs(r/2)}export{f as angle2D,a as distance2D,p as midpoint2D,l as pointInRect,h as polygonArea,s as rectsOverlap};
|
|
@@ -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 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function t(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,"&")}function n(e){return e.replace(/<[^>]*>/g,"")}function g(e){return e.replace(/\n/g,"<br>")}function p(e){return/<[^>]+>/.test(e)}export{p as containsHtml,t as escapeHtml,n as stripHtmlTags,g as textToHtml,r as unescapeHtml};
|
|
@@ -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 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function i(n="en"){return typeof process<"u"&&navigator.language?navigator.language.split("-")[0]||n:process?.env.LANG&&(process.env.LANG??"en").split("_")[0]||n}function o(n,t,r){return new Intl.NumberFormat(t,r).format(n)}function s(n,t,r){return new Intl.DateTimeFormat(t,r).format(n)}function g(n,t,r){let e=r||i();return t[e]?.[n]||t.en?.[n]||n}function u(n,t){return t===1?n:`${n}s`}export{i as detectLanguage,s as formatDateI18n,o as formatNumber,u as pluralize,g as t};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,cAGvB,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,GAAG,SAAS,SAEjD,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunks/chunk-ANN5UYCF.js";var o=()=>(console.log("test"),"testPackage"),t=e=>{console.log(`hello ${e??"world"}`)};export{t as helloWorld,o as testPackage};
|
|
@@ -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 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function r(e,t){return setInterval(e,t)}function n(e){clearInterval(e)}export{n as clearIntervalById,r as runInterval};
|
|
@@ -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 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function t(n,r=null){try{return JSON.parse(n)}catch{return r}}function e(n,r=null){try{return JSON.stringify(n)}catch{return r}}function s(n){try{return JSON.parse(n),!0}catch{return!1}}function u(n){return JSON.parse(JSON.stringify(n))}export{u as deepCloneJson,s as isValidJson,t as safeJsonParse,e as safeJsonStringify};
|
|
@@ -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,28 @@
|
|
|
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 declare function captureConsole(callback: (type: string, ...args: any[]) => void): () => void;
|
|
28
|
+
//# 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,wBAAgB,cAAc,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAgB3F"}
|
|
@@ -0,0 +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};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Console utility functions for logging and disabling console output in production.
|
|
3
|
+
* @module console
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Logs a message with a timestamp.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @param {...any[]} args
|
|
10
|
+
*/
|
|
11
|
+
export declare const logWithTimestamp: (...args: any[]) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Logs a warning message in yellow.
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @param {...any[]} args
|
|
17
|
+
*/
|
|
18
|
+
export declare const warn: (...args: any[]) => void;
|
|
19
|
+
/**
|
|
20
|
+
* Logs an error message in red.
|
|
21
|
+
*
|
|
22
|
+
* @export
|
|
23
|
+
* @param {...any[]} args
|
|
24
|
+
*/
|
|
25
|
+
export declare const error: (...args: any[]) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Logs an info message in blue.
|
|
28
|
+
*
|
|
29
|
+
* @export
|
|
30
|
+
* @param {...any[]} args
|
|
31
|
+
*/
|
|
32
|
+
export declare const info: (...args: any[]) => void;
|
|
33
|
+
//# sourceMappingURL=index1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index1.d.ts","sourceRoot":"","sources":["../../src/logging/index1.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;;;GAKG;AAEH,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,GAAG,EAAE,SAG9C,CAAA;AAED;;;;;GAKG;AAEH,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAElC,CAAA;AAED;;;;;GAKG;AAEH,eAAO,MAAM,KAAK,GAAI,GAAG,MAAM,GAAG,EAAE,SAEnC,CAAA;AAED;;;;;GAKG;AAEH,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,GAAG,EAAE,SAElC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";var t=(...o)=>{let n=new Date().toISOString();console.log(`[${n}]`,...o)},e=(...o)=>{console.warn("\x1B[33m%s\x1B[0m",...o)},s=(...o)=>{console.error("\x1B[31m%s\x1B[0m",...o)},r=(...o)=>{console.info("\x1B[34m%s\x1B[0m",...o)};export{s as error,r as info,t as logWithTimestamp,e 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 @@
|
|
|
1
|
+
import"../chunks/chunk-ANN5UYCF.js";function p(e){let t=new Map;for(let[n,o]of e)t.set(o,n);return t}function s(e,t){let n=new Map;for(let[o,r]of e)n.set(o,t(r,o));return n}function a(...e){let t=new Map;for(let n of e)for(let[o,r]of n)t.set(o,r);return t}function c(e){return new Map(Object.entries(e))}function V(e){let t={};for(let[n,o]of e)t[n]=o;return t}export{p as invertMap,V as mapToObject,s as mapValues,a as mergeMaps,c as objectToMap};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/math/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o,b as t}from"../chunks/chunk-DCFILRIS.js";import"../chunks/chunk-ANN5UYCF.js";var e=(r,m)=>r+m;export{o as add,t as subtract,e as sum};
|
|
@@ -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=math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../src/math/math.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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d}from"../chunks/chunk-DCFILRIS.js";import"../chunks/chunk-ANN5UYCF.js";export{a as add,d as divide,c as multiply,b as subtract};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/math/sum/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,WAAU,CAAA;AAE3C,OAAO,EAAE,GAAG,EAAE,CAAA"}
|