@arkyn/shared 3.0.1-beta.160 → 3.0.1-beta.168
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/package.json +17 -12
- package/dist/formats/formatDate.d.ts +0 -26
- package/dist/formats/formatDate.d.ts.map +0 -1
- package/dist/formats/formatJsonObject.d.ts +0 -31
- package/dist/formats/formatJsonObject.d.ts.map +0 -1
- package/dist/formats/formatJsonString.d.ts +0 -23
- package/dist/formats/formatJsonString.d.ts.map +0 -1
- package/dist/formats/formatToCapitalizeFirstWordLetter.d.ts +0 -16
- package/dist/formats/formatToCapitalizeFirstWordLetter.d.ts.map +0 -1
- package/dist/formats/formatToCep.d.ts +0 -21
- package/dist/formats/formatToCep.d.ts.map +0 -1
- package/dist/formats/formatToCnpj.d.ts +0 -19
- package/dist/formats/formatToCnpj.d.ts.map +0 -1
- package/dist/formats/formatToCpf.d.ts +0 -21
- package/dist/formats/formatToCpf.d.ts.map +0 -1
- package/dist/formats/formatToCurrency.d.ts +0 -21
- package/dist/formats/formatToCurrency.d.ts.map +0 -1
- package/dist/formats/formatToEllipsis.d.ts +0 -16
- package/dist/formats/formatToEllipsis.d.ts.map +0 -1
- package/dist/formats/formatToHiddenDigits.d.ts +0 -24
- package/dist/formats/formatToHiddenDigits.d.ts.map +0 -1
- package/dist/formats/formatToPhone.d.ts +0 -22
- package/dist/formats/formatToPhone.d.ts.map +0 -1
- package/dist/generators/generateColorByString.d.ts +0 -17
- package/dist/generators/generateColorByString.d.ts.map +0 -1
- package/dist/generators/generateId.d.ts +0 -17
- package/dist/generators/generateId.d.ts.map +0 -1
- package/dist/generators/generateSlug.d.ts +0 -23
- package/dist/generators/generateSlug.d.ts.map +0 -1
- package/dist/index.d.ts +0 -26
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -371
- package/dist/modules/formats/formatDate.js +0 -42
- package/dist/modules/formats/formatJsonObject.js +0 -32
- package/dist/modules/formats/formatJsonString.js +0 -13
- package/dist/modules/formats/formatToCapitalizeFirstWordLetter.js +0 -9
- package/dist/modules/formats/formatToCep.js +0 -9
- package/dist/modules/formats/formatToCnpj.js +0 -9
- package/dist/modules/formats/formatToCpf.js +0 -9
- package/dist/modules/formats/formatToCurrency.js +0 -15
- package/dist/modules/formats/formatToEllipsis.js +0 -11
- package/dist/modules/formats/formatToHiddenDigits.js +0 -12
- package/dist/modules/formats/formatToPhone.js +0 -17
- package/dist/modules/generators/generateColorByString.js +0 -9
- package/dist/modules/generators/generateId.js +0 -26
- package/dist/modules/generators/generateSlug.js +0 -7
- package/dist/modules/index.js +0 -52
- package/dist/modules/parsers/parseLargeFields.js +0 -22
- package/dist/modules/parsers/parseSensitiveData.js +0 -26
- package/dist/modules/parsers/parseToDate.js +0 -27
- package/dist/modules/services/validateDateService.js +0 -59
- package/dist/modules/utilities/calculateCardInstallment.js +0 -21
- package/dist/modules/utilities/ensureQuotes.js +0 -7
- package/dist/modules/utilities/findCountryMask.js +0 -25
- package/dist/modules/utilities/isHtml.js +0 -6
- package/dist/modules/utilities/removeCurrencySymbols.js +0 -6
- package/dist/modules/utilities/removeNonNumeric.js +0 -6
- package/dist/modules/utilities/stripHtmlTags.js +0 -6
- package/dist/parsers/parseLargeFields.d.ts +0 -29
- package/dist/parsers/parseLargeFields.d.ts.map +0 -1
- package/dist/parsers/parseSensitiveData.d.ts +0 -22
- package/dist/parsers/parseSensitiveData.d.ts.map +0 -1
- package/dist/parsers/parseToDate.d.ts +0 -25
- package/dist/parsers/parseToDate.d.ts.map +0 -1
- package/dist/services/validateDateService.d.ts +0 -34
- package/dist/services/validateDateService.d.ts.map +0 -1
- package/dist/utilities/calculateCardInstallment.d.ts +0 -25
- package/dist/utilities/calculateCardInstallment.d.ts.map +0 -1
- package/dist/utilities/ensureQuotes.d.ts +0 -20
- package/dist/utilities/ensureQuotes.d.ts.map +0 -1
- package/dist/utilities/findCountryMask.d.ts +0 -21
- package/dist/utilities/findCountryMask.d.ts.map +0 -1
- package/dist/utilities/isHtml.d.ts +0 -21
- package/dist/utilities/isHtml.d.ts.map +0 -1
- package/dist/utilities/removeCurrencySymbols.d.ts +0 -22
- package/dist/utilities/removeCurrencySymbols.d.ts.map +0 -1
- package/dist/utilities/removeNonNumeric.d.ts +0 -15
- package/dist/utilities/removeNonNumeric.d.ts.map +0 -1
- package/dist/utilities/stripHtmlTags.d.ts +0 -18
- package/dist/utilities/stripHtmlTags.d.ts.map +0 -1
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
function f(i, c = ["password", "confirmPassword", "creditCard"]) {
|
|
2
|
-
function u(r, e) {
|
|
3
|
-
return c.includes(r) ? "****" : e;
|
|
4
|
-
}
|
|
5
|
-
function t(r) {
|
|
6
|
-
return Array.isArray(r) ? r.map((e) => t(e)) : r !== null && typeof r == "object" ? Object.keys(r).reduce((e, s) => {
|
|
7
|
-
let n = r[s];
|
|
8
|
-
if (typeof n == "string")
|
|
9
|
-
try {
|
|
10
|
-
const a = JSON.parse(n);
|
|
11
|
-
typeof a == "object" && (n = JSON.stringify(t(a)));
|
|
12
|
-
} catch {
|
|
13
|
-
}
|
|
14
|
-
return e[s] = t(u(s, n)), e;
|
|
15
|
-
}, {}) : r;
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const r = JSON.parse(i), e = t(r);
|
|
19
|
-
return JSON.stringify(e);
|
|
20
|
-
} catch {
|
|
21
|
-
return i;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
f as parseSensitiveData
|
|
26
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ValidateDateService as u } from "../services/validateDateService.js";
|
|
2
|
-
function b([n, c = "00:00:00"], o, m = 0) {
|
|
3
|
-
const r = new u();
|
|
4
|
-
r.validateInputFormat(o);
|
|
5
|
-
const i = n.split(/[-/]/).map(Number), d = c.split(".")[0].split(":").map(Number);
|
|
6
|
-
let t, e, a;
|
|
7
|
-
const [l = 0, D = 0, p = 0] = d;
|
|
8
|
-
switch (o) {
|
|
9
|
-
case "brazilianDate":
|
|
10
|
-
[t, e, a] = i, r.validateDateParts(a, e, t);
|
|
11
|
-
break;
|
|
12
|
-
case "isoDate":
|
|
13
|
-
[e, t, a] = i, r.validateDateParts(a, e, t);
|
|
14
|
-
break;
|
|
15
|
-
case "timestamp":
|
|
16
|
-
[a, e, t] = i, r.validateDateParts(a, e, t);
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
const s = new Date(
|
|
20
|
-
Date.UTC(a, e - 1, t, l, D, p)
|
|
21
|
-
);
|
|
22
|
-
if (isNaN(s.getTime())) throw new Error("Invalid date");
|
|
23
|
-
return s.setUTCHours(s.getUTCHours() + m), s;
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
b as parseToDate
|
|
27
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
class l {
|
|
2
|
-
isLeapYear(e) {
|
|
3
|
-
return e % 4 === 0 && e % 100 !== 0 || e % 400 === 0;
|
|
4
|
-
}
|
|
5
|
-
getDaysInMonth(e, r) {
|
|
6
|
-
const a = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
|
|
7
|
-
return e === 2 && this.isLeapYear(r) ? 29 : a[e - 1];
|
|
8
|
-
}
|
|
9
|
-
validateDayInMonth(e, r, a) {
|
|
10
|
-
const t = this.getDaysInMonth(r, a);
|
|
11
|
-
if (e > t) {
|
|
12
|
-
const n = `Day ${e} is not valid for ${[
|
|
13
|
-
"January",
|
|
14
|
-
"February",
|
|
15
|
-
"March",
|
|
16
|
-
"April",
|
|
17
|
-
"May",
|
|
18
|
-
"June",
|
|
19
|
-
"July",
|
|
20
|
-
"August",
|
|
21
|
-
"September",
|
|
22
|
-
"October",
|
|
23
|
-
"November",
|
|
24
|
-
"December"
|
|
25
|
-
][r - 1]}`, o = `Day ${e} is not valid for February ${a} (non-leap year)`;
|
|
26
|
-
throw r === 2 && e === 29 ? new Error(o) : new Error(n);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Throws if year, month, or day are out of valid range or inconsistent with the calendar.
|
|
31
|
-
*
|
|
32
|
-
* @param year - 4-digit year (1000–9999).
|
|
33
|
-
* @param month - Month number (1–12).
|
|
34
|
-
* @param day - Day number (1–31, validated against the specific month).
|
|
35
|
-
*/
|
|
36
|
-
validateDateParts(e, r, a) {
|
|
37
|
-
const t = {
|
|
38
|
-
year: "Year should be four digits",
|
|
39
|
-
month: "Month should be between 1 and 12",
|
|
40
|
-
day: "Day should be between 1 and 31"
|
|
41
|
-
};
|
|
42
|
-
if (`${e}`.length !== 4) throw new Error(t.year);
|
|
43
|
-
if (r < 1 || r > 12) throw new Error(t.month);
|
|
44
|
-
if (a < 1 || a > 31) throw new Error(t.day);
|
|
45
|
-
this.validateDayInMonth(a, r, e);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Throws if `format` is not one of `"brazilianDate"`, `"isoDate"`, or `"timestamp"`.
|
|
49
|
-
*
|
|
50
|
-
* @param format - The format string to check.
|
|
51
|
-
*/
|
|
52
|
-
validateInputFormat(e) {
|
|
53
|
-
if (!["brazilianDate", "isoDate", "timestamp"].includes(e))
|
|
54
|
-
throw new Error(`Invalid input format: ${e}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
l as ValidateDateService
|
|
59
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function s(o) {
|
|
2
|
-
const { cashPrice: r, numberInstallments: t, fees: e = 0.0349 } = o;
|
|
3
|
-
if (e === 0 || t === 1)
|
|
4
|
-
return {
|
|
5
|
-
totalPrice: r,
|
|
6
|
-
installmentPrice: r / t
|
|
7
|
-
};
|
|
8
|
-
if (t <= 0)
|
|
9
|
-
throw new Error("Number of installments must be greater than 0");
|
|
10
|
-
if (e < 0)
|
|
11
|
-
throw new Error("Fees must be greater than or equal to 0");
|
|
12
|
-
let a = Math.pow(1 + e, t) * e, i = Math.pow(1 + e, t) - 1;
|
|
13
|
-
const n = +(r * (a / i)).toFixed(2);
|
|
14
|
-
return {
|
|
15
|
-
totalPrice: +(+(n * t).toFixed(2)).toFixed(2),
|
|
16
|
-
installmentPrice: +n.toFixed(2)
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
export {
|
|
20
|
-
s as calculateCardInstallment
|
|
21
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { countries as h } from "@arkyn/templates";
|
|
2
|
-
import { parsePhoneNumberWithError as a } from "libphonenumber-js";
|
|
3
|
-
import { removeNonNumeric as f } from "./removeNonNumeric.js";
|
|
4
|
-
function k(i) {
|
|
5
|
-
try {
|
|
6
|
-
const r = a(i), n = r == null ? void 0 : r.country;
|
|
7
|
-
if (!n) throw new Error("Invalid phone number");
|
|
8
|
-
const o = h.find((t) => t.iso === n);
|
|
9
|
-
if (!o) throw new Error("Phone number country not supported");
|
|
10
|
-
if (typeof o.mask == "string") return [o.mask, o];
|
|
11
|
-
const e = o.mask.find((t) => {
|
|
12
|
-
const s = t.replace(/[^_]/g, ""), m = f(r.nationalNumber), u = s.length, c = m.length;
|
|
13
|
-
return u === c;
|
|
14
|
-
});
|
|
15
|
-
if (!e)
|
|
16
|
-
throw new Error("No mask found for the given phone number length");
|
|
17
|
-
return [e, o];
|
|
18
|
-
} catch (r) {
|
|
19
|
-
const n = r;
|
|
20
|
-
throw new Error(n.message);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
k as findCountryMask
|
|
25
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
function r(e) {
|
|
2
|
-
return e.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, "").replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi, "").replace(/<!--[\s\S]*?-->/g, "").replace(/<\/?[a-z][a-z0-9]*[^>]*>/gi, "");
|
|
3
|
-
}
|
|
4
|
-
export {
|
|
5
|
-
r as stripHtmlTags
|
|
6
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Truncates large string fields in a JSON string to a specified maximum length.
|
|
3
|
-
*
|
|
4
|
-
* This function parses a JSON string, traverses its structure recursively, and truncates
|
|
5
|
-
* any string fields that exceed the specified maximum length. If a string field is truncated,
|
|
6
|
-
* it is replaced with a message indicating the original length of the field.
|
|
7
|
-
*
|
|
8
|
-
* @param jsonString - The JSON string to process.
|
|
9
|
-
* @param maxLength - The maximum allowed length for string fields. Defaults to 1000.
|
|
10
|
-
* @returns A JSON string with large string fields truncated.
|
|
11
|
-
*
|
|
12
|
-
* @throws {Error} Throws an error if the input is not a valid JSON string.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const json = JSON.stringify({
|
|
17
|
-
* name: "John",
|
|
18
|
-
* description: "A very long description that exceeds the maximum length...",
|
|
19
|
-
* nested: { details: "Another long string that needs truncation." }
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* const result = parseLargeFields(json, 50);
|
|
23
|
-
* console.log(result);
|
|
24
|
-
* // Output: '{"name":"John","description":"To large information: field as 57 characters","nested":{"details":"To large information: field as 43 characters"}}'
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
declare function parseLargeFields(jsonString: string, maxLength?: number): string;
|
|
28
|
-
export { parseLargeFields };
|
|
29
|
-
//# sourceMappingURL=parseLargeFields.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseLargeFields.d.ts","sourceRoot":"","sources":["../../src/parsers/parseLargeFields.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,iBAAS,gBAAgB,CACvB,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAAa,GACvB,MAAM,CA6BR;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Masks sensitive data in a JSON string by replacing the values of specified keys with "****".
|
|
3
|
-
*
|
|
4
|
-
* @param jsonString - The JSON string to be processed.
|
|
5
|
-
* @param sensitiveKeys - Keys whose values will be replaced with `"****"`. Defaults to `["password", "confirmPassword", "creditCard"]`.
|
|
6
|
-
* @returns A JSON string with sensitive values masked. Returns the original string if it is not valid JSON.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const jsonString = JSON.stringify({
|
|
11
|
-
* username: "user123",
|
|
12
|
-
* password: "secret",
|
|
13
|
-
* profile: { creditCard: "1234-5678-9012-3456" },
|
|
14
|
-
* });
|
|
15
|
-
*
|
|
16
|
-
* const result = parseSensitiveData(jsonString, ["password", "creditCard"]);
|
|
17
|
-
* console.log(result); // Output: '{"username":"user123","password":"****","profile":{"creditCard":"****"}}'
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
declare function parseSensitiveData(jsonString: string, sensitiveKeys?: string[]): string;
|
|
21
|
-
export { parseSensitiveData };
|
|
22
|
-
//# sourceMappingURL=parseSensitiveData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseSensitiveData.d.ts","sourceRoot":"","sources":["../../src/parsers/parseSensitiveData.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iBAAS,kBAAkB,CACzB,UAAU,EAAE,MAAM,EAClB,aAAa,GAAE,MAAM,EAAkD,GACtE,MAAM,CAkCR;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a date (and optional time) string into a JavaScript `Date` object.
|
|
3
|
-
* All calculations are in UTC+0; use `timezone` to shift the result.
|
|
4
|
-
*
|
|
5
|
-
* @param date - Date string in the format determined by `inputFormat`.
|
|
6
|
-
* @param time - Optional time string `"HH:mm:ss"` (defaults to `"00:00:00"`).
|
|
7
|
-
* @param inputFormat - Parsing format:
|
|
8
|
-
* - `"brazilianDate"`: DD/MM/YYYY
|
|
9
|
-
* - `"isoDate"`: MM-DD-YYYY
|
|
10
|
-
* - `"timestamp"`: YYYY-MM-DD
|
|
11
|
-
* @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.
|
|
12
|
-
* @returns A `Date` object representing the parsed date and time.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* parseToDate(["25/12/2023", "15:30:00"], "brazilianDate", -3);
|
|
17
|
-
* // Date: 2023-12-25T12:30:00.000Z
|
|
18
|
-
*
|
|
19
|
-
* parseToDate(["2023-12-25"], "timestamp");
|
|
20
|
-
* // Date: 2023-12-25T00:00:00.000Z
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
declare function parseToDate([date, time]: string[], inputFormat: "brazilianDate" | "isoDate" | "timestamp", timezone?: number): Date;
|
|
24
|
-
export { parseToDate };
|
|
25
|
-
//# sourceMappingURL=parseToDate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseToDate.d.ts","sourceRoot":"","sources":["../../src/parsers/parseToDate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,iBAAS,WAAW,CAClB,CAAC,IAAI,EAAE,IAAiB,CAAC,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,eAAe,GAAG,SAAS,GAAG,WAAW,EACtD,QAAQ,GAAE,MAAU,GACnB,IAAI,CAkCN;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates date components and input format strings for date-parsing utilities.
|
|
3
|
-
* Enforces 4-digit years, month/day ranges, month-specific day counts, and leap year rules.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* const service = new ValidateDateService();
|
|
8
|
-
* service.validateDateParts(2024, 2, 29); // OK — leap year
|
|
9
|
-
* service.validateDateParts(2023, 2, 29); // throws — not a leap year
|
|
10
|
-
* service.validateInputFormat("brazilianDate"); // OK
|
|
11
|
-
* service.validateInputFormat("custom"); // throws
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
declare class ValidateDateService {
|
|
15
|
-
private isLeapYear;
|
|
16
|
-
private getDaysInMonth;
|
|
17
|
-
private validateDayInMonth;
|
|
18
|
-
/**
|
|
19
|
-
* Throws if year, month, or day are out of valid range or inconsistent with the calendar.
|
|
20
|
-
*
|
|
21
|
-
* @param year - 4-digit year (1000–9999).
|
|
22
|
-
* @param month - Month number (1–12).
|
|
23
|
-
* @param day - Day number (1–31, validated against the specific month).
|
|
24
|
-
*/
|
|
25
|
-
validateDateParts(year: number, month: number, day: number): void;
|
|
26
|
-
/**
|
|
27
|
-
* Throws if `format` is not one of `"brazilianDate"`, `"isoDate"`, or `"timestamp"`.
|
|
28
|
-
*
|
|
29
|
-
* @param format - The format string to check.
|
|
30
|
-
*/
|
|
31
|
-
validateInputFormat(format: string): void;
|
|
32
|
-
}
|
|
33
|
-
export { ValidateDateService };
|
|
34
|
-
//# sourceMappingURL=validateDateService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateDateService.d.ts","sourceRoot":"","sources":["../../src/services/validateDateService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAM,mBAAmB;IACvB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,kBAAkB;IA2B1B;;;;;;OAMG;IACH,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAcjE;;;;OAIG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAM1C;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the per-installment and total price for a card payment plan with compound interest.
|
|
3
|
-
* No interest is applied when `fees` is `0` or `numberInstallments` is `1`.
|
|
4
|
-
*
|
|
5
|
-
* @param props.cashPrice - The base price of the item.
|
|
6
|
-
* @param props.numberInstallments - Number of installments (must be > 0).
|
|
7
|
-
* @param props.fees - Monthly interest rate (defaults to `0.0349`).
|
|
8
|
-
* @returns `{ totalPrice, installmentPrice }` — both rounded to 2 decimal places.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* calculateCardInstallment({ cashPrice: 1000, numberInstallments: 12, fees: 0.02 });
|
|
13
|
-
* // { totalPrice: 1124.62, installmentPrice: 93.72 }
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function calculateCardInstallment(props: {
|
|
17
|
-
cashPrice: number;
|
|
18
|
-
numberInstallments: number;
|
|
19
|
-
fees?: number;
|
|
20
|
-
}): {
|
|
21
|
-
totalPrice: number;
|
|
22
|
-
installmentPrice: number;
|
|
23
|
-
};
|
|
24
|
-
export { calculateCardInstallment };
|
|
25
|
-
//# sourceMappingURL=calculateCardInstallment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"calculateCardInstallment.d.ts","sourceRoot":"","sources":["../../src/utilities/calculateCardInstallment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,iBAAS,wBAAwB,CAAC,KAAK,EAAE;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,CA4BnD;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ensures that a given rawValue string is enclosed in quotes.
|
|
3
|
-
*
|
|
4
|
-
* This function checks if the input string is already enclosed in either single
|
|
5
|
-
* quotes (`'`) or double quotes (`"`). If the string is already quoted, it is
|
|
6
|
-
* returned as-is. Otherwise, the function wraps the string in double quotes.
|
|
7
|
-
*
|
|
8
|
-
* @param rawValue - The string to be checked and potentially quoted.
|
|
9
|
-
* @returns The original string if already quoted, otherwise the string wrapped in double quotes.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* ensureQuotes('example'); // Returns: '"example"'
|
|
14
|
-
* ensureQuotes('"already quoted"'); // Returns: '"already quoted"'
|
|
15
|
-
* ensureQuotes("'single quoted'"); // Returns: "'single quoted'"
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
declare function ensureQuotes(rawValue: string): string;
|
|
19
|
-
export { ensureQuotes };
|
|
20
|
-
//# sourceMappingURL=ensureQuotes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ensureQuotes.d.ts","sourceRoot":"","sources":["../../src/utilities/ensureQuotes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,iBAAS,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAS9C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type CountryType } from "@arkyn/templates";
|
|
2
|
-
/**
|
|
3
|
-
* Resolves the matching phone mask and country metadata for a given phone number.
|
|
4
|
-
* Masks use `"_"` as digit placeholders. For countries with multiple mask lengths
|
|
5
|
-
* (e.g. Brazil with and without the ninth digit), the mask matching the number's
|
|
6
|
-
* digit count is returned.
|
|
7
|
-
*
|
|
8
|
-
* @param phoneNumber - Phone number in E.164 format (e.g. `"+5511999999999"`).
|
|
9
|
-
* @returns A tuple of `[maskString, CountryType]`.
|
|
10
|
-
* @throws If the number is invalid or no mask is found for the parsed country.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* const [mask, country] = findCountryMask("+5511999999999");
|
|
15
|
-
* // mask: "(__) _____-____"
|
|
16
|
-
* // country.name: "Brazil"
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare function findCountryMask(phoneNumber: string): [string, CountryType];
|
|
20
|
-
export { findCountryMask };
|
|
21
|
-
//# sourceMappingURL=findCountryMask.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findCountryMask.d.ts","sourceRoot":"","sources":["../../src/utilities/findCountryMask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAI/D;;;;;;;;;;;;;;;;GAgBG;AAEH,iBAAS,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CA+BnE;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Check if a string contains HTML markup.
|
|
3
|
-
*
|
|
4
|
-
* This function uses a regular expression to detect the presence of HTML tags
|
|
5
|
-
* in a string. The check is case-insensitive and detects both opening
|
|
6
|
-
* and closing tags.
|
|
7
|
-
*
|
|
8
|
-
* @param rawString - The string to check.
|
|
9
|
-
* @returns `true` if the string contains HTML markup, `false` otherwise.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* isHtml('<p>Hello world</p>'); // true
|
|
14
|
-
* isHtml('<div>Content</div>'); // true
|
|
15
|
-
* isHtml('Plain text'); // false
|
|
16
|
-
* isHtml(''); // false
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare function isHtml(rawString: string): boolean;
|
|
20
|
-
export { isHtml };
|
|
21
|
-
//# sourceMappingURL=isHtml.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isHtml.d.ts","sourceRoot":"","sources":["../../src/utilities/isHtml.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAG1C;AAED,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes currency symbols from a given formatted string.
|
|
3
|
-
*
|
|
4
|
-
* This function takes a string that may contain currency symbols
|
|
5
|
-
* and removes them using a regular expression. The resulting string
|
|
6
|
-
* is also trimmed of any leading or trailing whitespace.
|
|
7
|
-
*
|
|
8
|
-
* @param rawString - The formatted string that may contain currency symbols.
|
|
9
|
-
* @returns The string with all currency symbols removed and trimmed of whitespace.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* removeCurrencySymbols("R$13,45"); // "13,45"
|
|
14
|
-
* removeCurrencySymbols("$123.45"); // "123.45"
|
|
15
|
-
* removeCurrencySymbols("€99.99"); // "99.99"
|
|
16
|
-
* removeCurrencySymbols("¥1,000"); // "1,000"
|
|
17
|
-
* removeCurrencySymbols("123.45"); // "123.45" (no symbols to remove)
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
declare function removeCurrencySymbols(rawString: string): string;
|
|
21
|
-
export { removeCurrencySymbols };
|
|
22
|
-
//# sourceMappingURL=removeCurrencySymbols.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"removeCurrencySymbols.d.ts","sourceRoot":"","sources":["../../src/utilities/removeCurrencySymbols.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iBAAS,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes all non-numeric characters from a given string.
|
|
3
|
-
*
|
|
4
|
-
* @param rawString - The input string to strip non-numeric characters from.
|
|
5
|
-
* @returns A new string containing only the numeric characters from the input.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* const result = removeNonNumeric("abc123def456");
|
|
10
|
-
* console.log(result); // Output: "123456"
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
declare function removeNonNumeric(rawString: string): string;
|
|
14
|
-
export { removeNonNumeric };
|
|
15
|
-
//# sourceMappingURL=removeNonNumeric.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"removeNonNumeric.d.ts","sourceRoot":"","sources":["../../src/utilities/removeNonNumeric.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,iBAAS,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Strips HTML tags from a string.
|
|
3
|
-
*
|
|
4
|
-
* This function removes all HTML tags from the provided string by replacing any content
|
|
5
|
-
* that matches the HTML tag pattern with an empty string.
|
|
6
|
-
*
|
|
7
|
-
* @param rawHtml - The HTML string to strip tags from.
|
|
8
|
-
* @returns The plain text with all HTML tags (including `<script>`, `<style>`, and comments) removed.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const strippedHtml = stripHtmlTags("<p>Hello <strong>World</strong></p>");
|
|
13
|
-
* console.log(strippedHtml); // "Hello World"
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
declare function stripHtmlTags(rawHtml: string): string;
|
|
17
|
-
export { stripHtmlTags };
|
|
18
|
-
//# sourceMappingURL=stripHtmlTags.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stripHtmlTags.d.ts","sourceRoot":"","sources":["../../src/utilities/stripHtmlTags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,iBAAS,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|