@arkyn/shared 3.0.1-beta.166 → 3.0.1-beta.170
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 +5 -4
- 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 -370
- package/dist/modules/formats/formatDate.js +0 -35
- package/dist/modules/formats/formatJsonObject.js +0 -23
- package/dist/modules/formats/formatJsonString.js +0 -11
- package/dist/modules/formats/formatToCapitalizeFirstWordLetter.js +0 -6
- 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 -13
- package/dist/modules/formats/formatToEllipsis.js +0 -10
- package/dist/modules/formats/formatToHiddenDigits.js +0 -22
- package/dist/modules/formats/formatToPhone.js +0 -14
- package/dist/modules/generators/generateColorByString.js +0 -8
- package/dist/modules/generators/generateId.js +0 -32
- package/dist/modules/generators/generateSlug.js +0 -7
- package/dist/modules/index.js +0 -26
- package/dist/modules/parsers/parseLargeFields.js +0 -17
- package/dist/modules/parsers/parseSensitiveData.js +0 -28
- package/dist/modules/parsers/parseToDate.js +0 -23
- package/dist/modules/services/validateDateService.js +0 -61
- package/dist/modules/utilities/calculateCardInstallment.js +0 -17
- package/dist/modules/utilities/ensureQuotes.js +0 -7
- package/dist/modules/utilities/findCountryMask.js +0 -23
- 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkyn/shared",
|
|
3
|
-
"version": "3.0.1-beta.
|
|
3
|
+
"version": "3.0.1-beta.170",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,14 +22,15 @@
|
|
|
22
22
|
"homepage": "https://docs.arkyn.dev/en/shared/introduction",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/Lucas-Eduardo-Goncalves/arkyn.git",
|
|
26
|
-
"directory": "packages/
|
|
25
|
+
"url": "git+https://github.com/Lucas-Eduardo-Goncalves/arkyn-library.git",
|
|
26
|
+
"directory": "packages/components"
|
|
27
27
|
},
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"scripts": {
|
|
30
30
|
"audit": "bun audit --workspace packages/shared",
|
|
31
31
|
"build": "bunx vite build && bunx tsc --project tsconfig.json --emitDeclarationOnly && bun ./generate-exports.ts",
|
|
32
|
-
"publish:beta": "
|
|
32
|
+
"publish:beta": "npm publish --tag beta",
|
|
33
|
+
"publish:latest": "npm publish --tag latest",
|
|
33
34
|
"release:beta": "bun ./generate-version.ts beta",
|
|
34
35
|
"release:patch": "bun ./generate-version.ts patch",
|
|
35
36
|
"release:minor": "bun ./generate-version.ts minor",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a date (and optional time) string into a custom output format.
|
|
3
|
-
* All calculations are in UTC+0; use the `timezone` parameter 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 outputFormat - Output template using `YYYY`, `MM`, `DD`, `hh`, `mm`, `ss` placeholders.
|
|
12
|
-
* @param timezone - UTC offset in hours (e.g. `-3` for UTC-3). Defaults to `0`.
|
|
13
|
-
* @returns The formatted date string.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* formatDate(["25/12/2023", "15:30:00"], "brazilianDate", "YYYY-MM-DD hh:mm");
|
|
18
|
-
* // "2023-12-25 15:30"
|
|
19
|
-
*
|
|
20
|
-
* formatDate(["2023-12-25", "15:30:00"], "timestamp", "DD/MM/YYYY hh:mm", -3);
|
|
21
|
-
* // "2023-12-25 12:30"
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare function formatDate([date, time]: string[], inputFormat: "brazilianDate" | "isoDate" | "timestamp", outputFormat: string, timezone?: number): string;
|
|
25
|
-
export { formatDate };
|
|
26
|
-
//# sourceMappingURL=formatDate.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatDate.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iBAAS,UAAU,CACjB,CAAC,IAAI,EAAE,IAAiB,CAAC,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,eAAe,GAAG,SAAS,GAAG,WAAW,EACtD,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,MAAU,GACnB,MAAM,CAkCR;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a JSON object into a human-readable string with proper indentation.
|
|
3
|
-
*
|
|
4
|
-
* - If the input is an object, it will be formatted with keys and values properly indented.
|
|
5
|
-
* - If the input is an array, each element will be formatted and indented on a new line.
|
|
6
|
-
* - If the input is a string that can be parsed as JSON, it will attempt to parse and format it.
|
|
7
|
-
* - Primitive values (e.g., numbers, booleans, null) will be converted to their string representation.
|
|
8
|
-
*
|
|
9
|
-
* @param json - The value to format: object, array, string, or primitive.
|
|
10
|
-
* @param indentLevel - Current indentation depth (used recursively; pass `0` at the top level).
|
|
11
|
-
* @returns A pretty-printed string representation of the value.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const obj = { name: "John", age: 30, hobbies: ["reading", "gaming"] };
|
|
16
|
-
* const formatted = formatJsonObject(obj, 0);
|
|
17
|
-
* console.log(formatted);
|
|
18
|
-
* // Output:
|
|
19
|
-
* // {
|
|
20
|
-
* // "name": "John",
|
|
21
|
-
* // "age": 30,
|
|
22
|
-
* // "hobbies": [
|
|
23
|
-
* // "reading",
|
|
24
|
-
* // "gaming"
|
|
25
|
-
* // ]
|
|
26
|
-
* // }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
declare const formatJsonObject: (json: any, indentLevel: number) => string;
|
|
30
|
-
export { formatJsonObject };
|
|
31
|
-
//# sourceMappingURL=formatJsonObject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatJsonObject.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,QAAA,MAAM,gBAAgB,GAAI,MAAM,GAAG,EAAE,aAAa,MAAM,KAAG,MAuD1D,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type FormatJsonStringFunction = (jsonString: string) => string;
|
|
2
|
-
/**
|
|
3
|
-
* Parses a JSON string and returns a human-readable pretty-printed representation.
|
|
4
|
-
* Throws if the input is not valid JSON.
|
|
5
|
-
*
|
|
6
|
-
* @param jsonString - A valid JSON string to format.
|
|
7
|
-
* @returns A pretty-printed string representation.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* formatJsonString('{"name":"John","hobbies":["reading","gaming"]}');
|
|
12
|
-
* // {
|
|
13
|
-
* // "name": "John",
|
|
14
|
-
* // "hobbies": [
|
|
15
|
-
* // "reading",
|
|
16
|
-
* // "gaming"
|
|
17
|
-
* // ]
|
|
18
|
-
* // }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
declare const formatJsonString: FormatJsonStringFunction;
|
|
22
|
-
export { formatJsonString };
|
|
23
|
-
//# sourceMappingURL=formatJsonString.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatJsonString.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonString.ts"],"names":[],"mappings":"AAEA,KAAK,wBAAwB,GAAG,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;AAE/D;;;;;;;;;;;;;;;;;;GAkBG;AAEH,QAAA,MAAM,gBAAgB,EAAE,wBAOvB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capitalizes the first letter of each word and lowercases the rest.
|
|
3
|
-
* Words are separated by spaces.
|
|
4
|
-
*
|
|
5
|
-
* @param sentence - The string to format.
|
|
6
|
-
* @returns The sentence with every word title-cased.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* formatToCapitalizeFirstWordLetter("hello world"); // "Hello World"
|
|
11
|
-
* formatToCapitalizeFirstWordLetter("HELLO WORLD"); // "Hello World"
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
declare function formatToCapitalizeFirstWordLetter(sentence: string): string;
|
|
15
|
-
export { formatToCapitalizeFirstWordLetter };
|
|
16
|
-
//# sourceMappingURL=formatToCapitalizeFirstWordLetter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCapitalizeFirstWordLetter.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCapitalizeFirstWordLetter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,iBAAS,iCAAiC,CAAC,QAAQ,EAAE,MAAM,UAU1D;AAED,OAAO,EAAE,iCAAiC,EAAE,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a given string into a Brazilian postal code (CEP) format.
|
|
3
|
-
*
|
|
4
|
-
* The function removes all non-numeric characters from the input string
|
|
5
|
-
* and attempts to format it as a CEP in the pattern `XXXXX-XXX`.
|
|
6
|
-
* If the input does not match the expected format, an error is thrown.
|
|
7
|
-
*
|
|
8
|
-
* @param value - Input string with 8 numeric digits (special characters are stripped).
|
|
9
|
-
* @returns The formatted CEP string in the pattern `XXXXX-XXX`.
|
|
10
|
-
*
|
|
11
|
-
* @throws {Error} If the input does not match the expected CEP format.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const formattedCep = formatToCep("12345678");
|
|
16
|
-
* console.log(formattedCep); // Output: "12345-678"
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare function formatToCep(value: string): string;
|
|
20
|
-
export { formatToCep };
|
|
21
|
-
//# sourceMappingURL=formatToCep.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCep.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCep.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ1C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a given string or number into a CNPJ (Cadastro Nacional da Pessoa Jurídica) format.
|
|
3
|
-
*
|
|
4
|
-
* The CNPJ format is: `XX.XXX.XXX/XXXX-XX`, where `X` represents a digit.
|
|
5
|
-
*
|
|
6
|
-
* @param value - Input string with 14 numeric digits (special characters are stripped).
|
|
7
|
-
* @returns The formatted CNPJ string in the pattern `XX.XXX.XXX/XXXX-XX`.
|
|
8
|
-
*
|
|
9
|
-
* @throws {Error} Throws an error if the input does not contain exactly 14 numeric digits.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const formattedCnpj = formatToCnpj("12345678000195");
|
|
14
|
-
* console.log(formattedCnpj); // Output: "12.345.678/0001-95"
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function formatToCnpj(value: string): string;
|
|
18
|
-
export { formatToCnpj };
|
|
19
|
-
//# sourceMappingURL=formatToCnpj.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCnpj.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCnpj.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AAEH,iBAAS,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ3C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a given string into a CPF (Cadastro de Pessoas Físicas) format.
|
|
3
|
-
*
|
|
4
|
-
* A CPF is a Brazilian individual taxpayer registry identification format.
|
|
5
|
-
* This function ensures the input is cleaned of non-numeric characters and
|
|
6
|
-
* then formats it into the standard CPF format: `XXX.XXX.XXX-XX`.
|
|
7
|
-
*
|
|
8
|
-
* @param value - Input string with 11 numeric digits (special characters are stripped).
|
|
9
|
-
* @returns The formatted CPF string in the pattern `XXX.XXX.XXX-XX`.
|
|
10
|
-
*
|
|
11
|
-
* @throws {Error} If the input string does not match the expected CPF format.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const formattedCpf = formatToCpf("12345678909");
|
|
16
|
-
* console.log(formattedCpf); // Output: "123.456.789-09"
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare function formatToCpf(value: string): string;
|
|
20
|
-
export { formatToCpf };
|
|
21
|
-
//# sourceMappingURL=formatToCpf.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCpf.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCpf.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ1C;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { countryCurrencies } from "@arkyn/templates";
|
|
2
|
-
type Currencies = keyof typeof countryCurrencies;
|
|
3
|
-
/**
|
|
4
|
-
* Formats a number into a locale-aware currency string using `Intl.NumberFormat`.
|
|
5
|
-
*
|
|
6
|
-
* @param value - The numeric value to format.
|
|
7
|
-
* @param currency - A currency code from `@arkyn/templates` (e.g. `"BRL"`, `"USD"`).
|
|
8
|
-
* @param config.showPrefix - Whether to include the currency symbol. Defaults to `true`.
|
|
9
|
-
* @returns The formatted currency string.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* formatToCurrency(1234.56, "BRL"); // "R$ 1.234,56"
|
|
14
|
-
* formatToCurrency(1234.56, "USD", { showPrefix: false }); // "1,234.56"
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
declare function formatToCurrency(value: number, currency: Currencies, config?: {
|
|
18
|
-
showPrefix?: boolean;
|
|
19
|
-
}): string;
|
|
20
|
-
export { formatToCurrency };
|
|
21
|
-
//# sourceMappingURL=formatToCurrency.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCurrency.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCurrency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,KAAK,UAAU,GAAG,MAAM,OAAO,iBAAiB,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,iBAAS,gBAAgB,CACvB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAChC,MAAM,CAiBR;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Truncates a given text to a specified maximum length and appends an ellipsis ("...")
|
|
3
|
-
* if the text exceeds the maximum length.
|
|
4
|
-
*
|
|
5
|
-
* @param text - The input string to be truncated.
|
|
6
|
-
* @param maxLength - Maximum allowed length before truncation.
|
|
7
|
-
* @returns The truncated string with `"..."` appended, or the original string if it fits.
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* const result = formatToEllipsis("Hello, world!", 5);
|
|
11
|
-
* console.log(result); // Output: "Hello..."
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
declare function formatToEllipsis(text: string, maxLength: number): string;
|
|
15
|
-
export { formatToEllipsis };
|
|
16
|
-
//# sourceMappingURL=formatToEllipsis.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToEllipsis.d.ts","sourceRoot":"","sources":["../../src/formats/formatToEllipsis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,iBAAS,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAsBjE;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Replaces specific digits in a string with a masking character, leaving non-digit characters unchanged.
|
|
3
|
-
*
|
|
4
|
-
* @param value - The input string to mask.
|
|
5
|
-
* @param options.range - Which digits to hide:
|
|
6
|
-
* - Positive number `n` — hides the first `n` digits.
|
|
7
|
-
* - Negative number `-n` — hides the last `n` digits.
|
|
8
|
-
* - Tuple `[start, end]` — hides digits from position `start` to `end` (inclusive, 1-indexed).
|
|
9
|
-
* - Defaults to `3`.
|
|
10
|
-
* @param options.hider - The masking character. Defaults to `"*"`.
|
|
11
|
-
* @returns The string with the specified digit positions replaced.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* formatToHiddenDigits("123-456-7890", { range: 3 }); // "***-456-7890"
|
|
16
|
-
* formatToHiddenDigits("123-456-7890", { range: [4, 6], hider: "#" }); // "123-###-7890"
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
declare function formatToHiddenDigits(value: string, options?: {
|
|
20
|
-
range?: number | [number, number];
|
|
21
|
-
hider?: string;
|
|
22
|
-
}): string;
|
|
23
|
-
export { formatToHiddenDigits };
|
|
24
|
-
//# sourceMappingURL=formatToHiddenDigits.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToHiddenDigits.d.ts","sourceRoot":"","sources":["../../src/formats/formatToHiddenDigits.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,oBAAoB,CAC3B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D,MAAM,CAWR;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Formats a phone number string according to the country mask defined in `@arkyn/templates`.
|
|
3
|
-
*
|
|
4
|
-
* The function parses the input using libphonenumber-js to determine the country and
|
|
5
|
-
* national number, then applies the corresponding country's mask (underscore `_` used
|
|
6
|
-
* as digit placeholder) replacing placeholders with actual digits.
|
|
7
|
-
*
|
|
8
|
-
* @param phoneNumber - The input phone number in E.164 format (e.g. `"+5534920524282"`).
|
|
9
|
-
* @returns The phone number formatted according to the country's mask.
|
|
10
|
-
*
|
|
11
|
-
* @throws {Error} If the phone number is invalid or if no country mask is found for the parsed country.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* console.log(formatToPhone("+5534920524282")); // Output: "(34) 92052-4282" (Brazilian format)
|
|
16
|
-
* console.log(formatToPhone("+553420524282")); // Output: "(34) 2052-4282" (Brazilian format with optional ninth digit)
|
|
17
|
-
* console.log(formatToPhone("+12125550199")); // Output: "(212) 555-0199" (American Samoa format)
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
declare function formatToPhone(phoneNumber: string): string;
|
|
21
|
-
export { formatToPhone };
|
|
22
|
-
//# sourceMappingURL=formatToPhone.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatToPhone.d.ts","sourceRoot":"","sources":["../../src/formats/formatToPhone.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iBAAS,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA0BlD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a hexadecimal color code based on the input string.
|
|
3
|
-
* The function creates a hash from the string and uses it to calculate
|
|
4
|
-
* RGB values, which are then converted to a hexadecimal color code.
|
|
5
|
-
*
|
|
6
|
-
* @param rawString - The input string used to generate the color.
|
|
7
|
-
* @returns A hexadecimal color code (e.g., `"#a1b2c3"`) derived from the input string.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* const color = generateColorByString("example");
|
|
12
|
-
* console.log(color); // Outputs a consistent hex color like "#5e8f9a"
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
declare function generateColorByString(rawString: string): string;
|
|
16
|
-
export { generateColorByString };
|
|
17
|
-
//# sourceMappingURL=generateColorByString.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateColorByString.d.ts","sourceRoot":"","sources":["../../src/generators/generateColorByString.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iBAAS,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAgBxD;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a UUID in the specified version and output type.
|
|
3
|
-
*
|
|
4
|
-
* @param type - Output representation: `"text"` (string) or `"binary"` (`Uint8Array`).
|
|
5
|
-
* @param format - UUID version: `"v4"` (random) or `"v7"` (time-ordered).
|
|
6
|
-
* @returns The UUID as a string or `Uint8Array` depending on `type`.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* generateId("text", "v4"); // "550e8400-e29b-41d4-a716-446655440000"
|
|
11
|
-
* generateId("binary", "v7"); // Uint8Array([...])
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
declare function generateId(type: "text", format: "v4" | "v7"): string;
|
|
15
|
-
declare function generateId(type: "binary", format: "v4" | "v7"): Uint8Array;
|
|
16
|
-
export { generateId };
|
|
17
|
-
//# sourceMappingURL=generateId.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateId.d.ts","sourceRoot":"","sources":["../../src/generators/generateId.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;GAYG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;AAC/D,iBAAS,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,UAAU,CAAC;AAYrE,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generates a URL-friendly slug from a given string.
|
|
3
|
-
*
|
|
4
|
-
* The function performs the following transformations:
|
|
5
|
-
* - Normalizes the string to remove diacritical marks (e.g., accents).
|
|
6
|
-
* - Removes non-alphanumeric characters except for spaces and hyphens.
|
|
7
|
-
* - Replaces spaces with hyphens.
|
|
8
|
-
* - Converts the string to lowercase.
|
|
9
|
-
* - Collapses multiple consecutive hyphens into a single hyphen.
|
|
10
|
-
* - Trims leading and trailing hyphens.
|
|
11
|
-
*
|
|
12
|
-
* @param rawString - The input string to be converted into a slug.
|
|
13
|
-
* @returns A URL-friendly slug derived from the input string.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```typescript
|
|
17
|
-
* const slug = generateSlug("Hello, World! This is a Test.");
|
|
18
|
-
* console.log(slug); // Outputs: "hello-world-this-is-a-test"
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
declare function generateSlug(rawString: string): string;
|
|
22
|
-
export { generateSlug };
|
|
23
|
-
//# sourceMappingURL=generateSlug.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateSlug.d.ts","sourceRoot":"","sources":["../../src/generators/generateSlug.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iBAAS,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAa/C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export { formatDate } from "./formats/formatDate";
|
|
2
|
-
export { formatJsonObject } from "./formats/formatJsonObject";
|
|
3
|
-
export { formatJsonString } from "./formats/formatJsonString";
|
|
4
|
-
export { formatToCapitalizeFirstWordLetter } from "./formats/formatToCapitalizeFirstWordLetter";
|
|
5
|
-
export { formatToCep } from "./formats/formatToCep";
|
|
6
|
-
export { formatToCnpj } from "./formats/formatToCnpj";
|
|
7
|
-
export { formatToCpf } from "./formats/formatToCpf";
|
|
8
|
-
export { formatToCurrency } from "./formats/formatToCurrency";
|
|
9
|
-
export { formatToEllipsis } from "./formats/formatToEllipsis";
|
|
10
|
-
export { formatToHiddenDigits } from "./formats/formatToHiddenDigits";
|
|
11
|
-
export { formatToPhone } from "./formats/formatToPhone";
|
|
12
|
-
export { generateColorByString } from "./generators/generateColorByString";
|
|
13
|
-
export { generateId } from "./generators/generateId";
|
|
14
|
-
export { generateSlug } from "./generators/generateSlug";
|
|
15
|
-
export { parseLargeFields } from "./parsers/parseLargeFields";
|
|
16
|
-
export { parseSensitiveData } from "./parsers/parseSensitiveData";
|
|
17
|
-
export { parseToDate } from "./parsers/parseToDate";
|
|
18
|
-
export { ValidateDateService } from "./services/validateDateService";
|
|
19
|
-
export { calculateCardInstallment } from "./utilities/calculateCardInstallment";
|
|
20
|
-
export { ensureQuotes } from "./utilities/ensureQuotes";
|
|
21
|
-
export { findCountryMask } from "./utilities/findCountryMask";
|
|
22
|
-
export { isHtml } from "./utilities/isHtml";
|
|
23
|
-
export { removeCurrencySymbols } from "./utilities/removeCurrencySymbols";
|
|
24
|
-
export { removeNonNumeric } from "./utilities/removeNonNumeric";
|
|
25
|
-
export { stripHtmlTags } from "./utilities/stripHtmlTags";
|
|
26
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAGxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC"}
|