@arkyn/shared 3.0.1-beta.99 → 3.0.3
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/LICENSE.txt +184 -1
- package/README.md +196 -306
- package/dist/formats/formatDate.d.ts +18 -26
- package/dist/formats/formatDate.d.ts.map +1 -1
- package/dist/formats/formatJsonObject.d.ts +5 -7
- package/dist/formats/formatJsonObject.d.ts.map +1 -1
- package/dist/formats/formatJsonString.d.ts +5 -21
- package/dist/formats/formatJsonString.d.ts.map +1 -1
- package/dist/formats/formatToCapitalizeFirstWordLetter.d.ts +5 -24
- package/dist/formats/formatToCapitalizeFirstWordLetter.d.ts.map +1 -1
- package/dist/formats/formatToCep.d.ts +3 -11
- package/dist/formats/formatToCep.d.ts.map +1 -1
- package/dist/formats/formatToCnpj.d.ts +3 -14
- package/dist/formats/formatToCnpj.d.ts.map +1 -1
- package/dist/formats/formatToCpf.d.ts +4 -13
- package/dist/formats/formatToCpf.d.ts.map +1 -1
- package/dist/formats/formatToCurrency.d.ts +10 -23
- package/dist/formats/formatToCurrency.d.ts.map +1 -1
- package/dist/formats/formatToEllipsis.d.ts +5 -5
- package/dist/formats/formatToEllipsis.d.ts.map +1 -1
- package/dist/formats/formatToHiddenDigits.d.ts +15 -26
- package/dist/formats/formatToHiddenDigits.d.ts.map +1 -1
- package/dist/formats/formatToPhone.d.ts +11 -23
- package/dist/formats/formatToPhone.d.ts.map +1 -1
- package/dist/generators/generateColorByString.d.ts +6 -4
- package/dist/generators/generateColorByString.d.ts.map +1 -1
- package/dist/generators/generateId.d.ts +8 -19
- package/dist/generators/generateId.d.ts.map +1 -1
- package/dist/generators/generateSlug.d.ts +8 -2
- package/dist/generators/generateSlug.d.ts.map +1 -1
- package/dist/index.d.ts +11 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +373 -27
- package/dist/index.js.map +1 -0
- package/dist/modules/formats/formatDate.js +37 -0
- package/dist/modules/formats/formatDate.js.map +1 -0
- package/dist/modules/formats/formatJsonObject.js +25 -0
- package/dist/modules/formats/formatJsonObject.js.map +1 -0
- package/dist/modules/formats/formatJsonString.js +13 -0
- package/dist/modules/formats/formatJsonString.js.map +1 -0
- package/dist/modules/formats/formatToCapitalizeFirstWordLetter.js +8 -0
- package/dist/modules/formats/formatToCapitalizeFirstWordLetter.js.map +1 -0
- package/dist/modules/formats/formatToCep.js +11 -0
- package/dist/modules/formats/formatToCep.js.map +1 -0
- package/dist/modules/formats/formatToCnpj.js +11 -0
- package/dist/modules/formats/formatToCnpj.js.map +1 -0
- package/dist/modules/formats/formatToCpf.js +11 -0
- package/dist/modules/formats/formatToCpf.js.map +1 -0
- package/dist/modules/formats/formatToCurrency.js +15 -0
- package/dist/modules/formats/formatToCurrency.js.map +1 -0
- package/dist/modules/formats/formatToEllipsis.js +12 -0
- package/dist/modules/formats/formatToEllipsis.js.map +1 -0
- package/dist/modules/formats/formatToHiddenDigits.js +24 -0
- package/dist/modules/formats/formatToHiddenDigits.js.map +1 -0
- package/dist/modules/formats/formatToPhone.js +16 -0
- package/dist/modules/formats/formatToPhone.js.map +1 -0
- package/dist/modules/generators/generateColorByString.js +11 -0
- package/dist/modules/generators/generateColorByString.js.map +1 -0
- package/dist/modules/generators/generateId.js +34 -0
- package/dist/modules/generators/generateId.js.map +1 -0
- package/dist/modules/generators/generateSlug.js +9 -0
- package/dist/modules/generators/generateSlug.js.map +1 -0
- package/dist/modules/parsers/parseLargeFields.js +19 -0
- package/dist/modules/parsers/parseLargeFields.js.map +1 -0
- package/dist/modules/parsers/parseSensitiveData.js +30 -0
- package/dist/modules/parsers/parseSensitiveData.js.map +1 -0
- package/dist/modules/parsers/parseToDate.js +25 -0
- package/dist/modules/parsers/parseToDate.js.map +1 -0
- package/dist/modules/services/validateDateService.js +63 -0
- package/dist/modules/services/validateDateService.js.map +1 -0
- package/dist/modules/utilities/calculateCardInstallment.js +19 -0
- package/dist/modules/utilities/calculateCardInstallment.js.map +1 -0
- package/dist/modules/utilities/ensureQuotes.js +9 -0
- package/dist/modules/utilities/ensureQuotes.js.map +1 -0
- package/dist/modules/utilities/findCountryMask.js +25 -0
- package/dist/modules/utilities/findCountryMask.js.map +1 -0
- package/dist/modules/utilities/isHtml.js +8 -0
- package/dist/modules/utilities/isHtml.js.map +1 -0
- package/dist/modules/utilities/removeCurrencySymbols.js +8 -0
- package/dist/modules/utilities/removeCurrencySymbols.js.map +1 -0
- package/dist/modules/utilities/removeNonNumeric.js +8 -0
- package/dist/modules/utilities/removeNonNumeric.js.map +1 -0
- package/dist/modules/utilities/stripHtmlTags.js +8 -0
- package/dist/modules/utilities/stripHtmlTags.js.map +1 -0
- package/dist/{services/truncateLargeFields.d.ts → parsers/parseLargeFields.d.ts} +5 -8
- package/dist/parsers/parseLargeFields.d.ts.map +1 -0
- package/dist/parsers/parseSensitiveData.d.ts +22 -0
- package/dist/parsers/parseSensitiveData.d.ts.map +1 -0
- package/dist/parsers/parseToDate.d.ts +25 -0
- package/dist/parsers/parseToDate.d.ts.map +1 -0
- package/dist/services/validateDateService.d.ts +34 -0
- package/dist/services/validateDateService.d.ts.map +1 -0
- package/dist/utilities/calculateCardInstallment.d.ts +25 -0
- package/dist/utilities/calculateCardInstallment.d.ts.map +1 -0
- package/dist/utilities/ensureQuotes.d.ts +20 -0
- package/dist/utilities/ensureQuotes.d.ts.map +1 -0
- package/dist/utilities/findCountryMask.d.ts +21 -0
- package/dist/utilities/findCountryMask.d.ts.map +1 -0
- package/dist/utilities/isHtml.d.ts +21 -0
- package/dist/utilities/isHtml.d.ts.map +1 -0
- package/dist/{services/removeCurrencySymbols.js → utilities/removeCurrencySymbols.d.ts} +6 -7
- package/dist/utilities/removeCurrencySymbols.d.ts.map +1 -0
- package/dist/utilities/removeNonNumeric.d.ts +15 -0
- package/dist/utilities/removeNonNumeric.d.ts.map +1 -0
- package/dist/utilities/stripHtmlTags.d.ts +18 -0
- package/dist/utilities/stripHtmlTags.d.ts.map +1 -0
- package/package.json +255 -16
- package/dist/bundle.js +0 -2337
- package/dist/bundle.umd.cjs +0 -6
- package/dist/formats/formatDate.js +0 -66
- package/dist/formats/formatJsonObject.js +0 -90
- package/dist/formats/formatJsonString.js +0 -46
- package/dist/formats/formatToCapitalizeFirstWordLetter.js +0 -42
- package/dist/formats/formatToCep.js +0 -34
- package/dist/formats/formatToCnpj.js +0 -35
- package/dist/formats/formatToCpf.js +0 -35
- package/dist/formats/formatToCpfCnpj.d.ts +0 -24
- package/dist/formats/formatToCpfCnpj.d.ts.map +0 -1
- package/dist/formats/formatToCpfCnpj.js +0 -33
- package/dist/formats/formatToCurrency.js +0 -41
- package/dist/formats/formatToDate.d.ts +0 -32
- package/dist/formats/formatToDate.d.ts.map +0 -1
- package/dist/formats/formatToDate.js +0 -50
- package/dist/formats/formatToEllipsis.js +0 -21
- package/dist/formats/formatToHiddenDigits.js +0 -60
- package/dist/formats/formatToPhone.js +0 -131
- package/dist/generators/generateColorByString.js +0 -25
- package/dist/generators/generateId.js +0 -29
- package/dist/generators/generateSlug.js +0 -25
- package/dist/services/calculateCardInstallment.d.ts +0 -40
- package/dist/services/calculateCardInstallment.d.ts.map +0 -1
- package/dist/services/calculateCardInstallment.js +0 -55
- package/dist/services/ensureQuotes.d.ts +0 -14
- package/dist/services/ensureQuotes.d.ts.map +0 -1
- package/dist/services/ensureQuotes.js +0 -19
- package/dist/services/isHtml.d.ts +0 -22
- package/dist/services/isHtml.d.ts.map +0 -1
- package/dist/services/isHtml.js +0 -24
- package/dist/services/maskSensitiveData.d.ts +0 -26
- package/dist/services/maskSensitiveData.d.ts.map +0 -1
- package/dist/services/maskSensitiveData.js +0 -60
- package/dist/services/removeCurrencySymbols.d.ts +0 -21
- package/dist/services/removeCurrencySymbols.d.ts.map +0 -1
- package/dist/services/removeNonNumeric.d.ts +0 -16
- package/dist/services/removeNonNumeric.d.ts.map +0 -1
- package/dist/services/removeNonNumeric.js +0 -16
- package/dist/services/stripHtmlTags.d.ts +0 -16
- package/dist/services/stripHtmlTags.d.ts.map +0 -1
- package/dist/services/stripHtmlTags.js +0 -16
- package/dist/services/truncateLargeFields.d.ts.map +0 -1
- package/dist/services/truncateLargeFields.js +0 -57
|
@@ -1,34 +1,26 @@
|
|
|
1
|
-
type InputFormatTypes = "brazilianDate" | "isoDate" | "timestamp";
|
|
2
|
-
type FormatDateFunction = (date: string[], // [date: string, time?: string]
|
|
3
|
-
inputFormat: InputFormatTypes, outputFormat: string, timezone?: number) => string;
|
|
4
1
|
/**
|
|
5
|
-
* Formats a date and time string
|
|
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.
|
|
6
4
|
*
|
|
7
|
-
* @param
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* - "
|
|
12
|
-
* - "
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
*
|
|
16
|
-
* @param {number} [timezone=0] - The timezone offset in hours to apply to the date.
|
|
17
|
-
* - Defaults to 0 (UTC).
|
|
18
|
-
* @returns {string} The formatted date string based on the output format.
|
|
19
|
-
* @throws {Error} If the input format is invalid.
|
|
20
|
-
* @throws {Error} If the date is invalid.
|
|
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.
|
|
21
14
|
*
|
|
22
15
|
* @example
|
|
23
|
-
*
|
|
24
|
-
* formatDate(["25/12/2023", "15:30:00"], "brazilianDate", "YYYY-MM-DD hh:mm
|
|
25
|
-
* //
|
|
16
|
+
* ```typescript
|
|
17
|
+
* formatDate(["25/12/2023", "15:30:00"], "brazilianDate", "YYYY-MM-DD hh:mm");
|
|
18
|
+
* // "2023-12-25 15:30"
|
|
26
19
|
*
|
|
27
|
-
*
|
|
28
|
-
* //
|
|
29
|
-
*
|
|
30
|
-
* // Returns: "25/12/2023 12:30:00"
|
|
20
|
+
* formatDate(["2023-12-25", "15:30:00"], "timestamp", "DD/MM/YYYY hh:mm", -3);
|
|
21
|
+
* // "2023-12-25 12:30"
|
|
22
|
+
* ```
|
|
31
23
|
*/
|
|
32
|
-
declare
|
|
24
|
+
declare function formatDate([date, time]: string[], inputFormat: "brazilianDate" | "isoDate" | "timestamp", outputFormat: string, timezone?: number): string;
|
|
33
25
|
export { formatDate };
|
|
34
26
|
//# sourceMappingURL=formatDate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatDate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatDate.d.ts","sourceRoot":"","sources":["../../src/formats/formatDate.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,iBAAS,UAAU,CAClB,CAAC,IAAI,EAAE,IAAiB,CAAC,EAAE,MAAM,EAAE,EACnC,WAAW,EAAE,eAAe,GAAG,SAAS,GAAG,WAAW,EACtD,YAAY,EAAE,MAAM,EACpB,QAAQ,GAAE,MAAU,GAClB,MAAM,CAkCR;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
type FormatJsonObjectFunction = (jsonString: any, identLevel: number) => string;
|
|
2
1
|
/**
|
|
3
2
|
* Formats a JSON object into a human-readable string with proper indentation.
|
|
4
3
|
*
|
|
5
|
-
* @param obj - The JSON object or value to format. It can be an object, array, string, or primitive value.
|
|
6
|
-
* @param indentLevel - The current level of indentation to apply. This is used recursively to format nested structures.
|
|
7
|
-
* @returns A formatted string representation of the JSON object.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
4
|
* - If the input is an object, it will be formatted with keys and values properly indented.
|
|
11
5
|
* - If the input is an array, each element will be formatted and indented on a new line.
|
|
12
6
|
* - If the input is a string that can be parsed as JSON, it will attempt to parse and format it.
|
|
13
7
|
* - Primitive values (e.g., numbers, booleans, null) will be converted to their string representation.
|
|
14
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
|
+
*
|
|
15
13
|
* @example
|
|
16
14
|
* ```typescript
|
|
17
15
|
* const obj = { name: "John", age: 30, hobbies: ["reading", "gaming"] };
|
|
@@ -28,6 +26,6 @@ type FormatJsonObjectFunction = (jsonString: any, identLevel: number) => string;
|
|
|
28
26
|
* // }
|
|
29
27
|
* ```
|
|
30
28
|
*/
|
|
31
|
-
declare const formatJsonObject:
|
|
29
|
+
declare const formatJsonObject: (json: any, indentLevel: number) => string;
|
|
32
30
|
export { formatJsonObject };
|
|
33
31
|
//# sourceMappingURL=formatJsonObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatJsonObject.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonObject.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"formatJsonObject.d.ts","sourceRoot":"","sources":["../../src/formats/formatJsonObject.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,QAAA,MAAM,gBAAgB,GAAI,MAAM,GAAG,EAAE,aAAa,MAAM,KAAG,MAsD1D,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,37 +1,21 @@
|
|
|
1
1
|
type FormatJsonStringFunction = (jsonString: string) => string;
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Parses a JSON string and returns a human-readable pretty-printed representation.
|
|
4
|
+
* Throws if the input is not valid JSON.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* is not a valid JSON, it logs an error to the console and returns an empty string.
|
|
8
|
-
*
|
|
9
|
-
* @param jsonString - The JSON string to be formatted.
|
|
10
|
-
* @returns A formatted JSON string, or an empty string if the input is invalid.
|
|
11
|
-
*
|
|
12
|
-
* @throws Will log an error to the console if the input is not a valid JSON string.
|
|
6
|
+
* @param jsonString - A valid JSON string to format.
|
|
7
|
+
* @returns A pretty-printed string representation.
|
|
13
8
|
*
|
|
14
9
|
* @example
|
|
15
10
|
* ```typescript
|
|
16
|
-
*
|
|
17
|
-
* const formatted = formatJsonString(jsonString);
|
|
18
|
-
* console.log(formatted);
|
|
19
|
-
* // Output:
|
|
11
|
+
* formatJsonString('{"name":"John","hobbies":["reading","gaming"]}');
|
|
20
12
|
* // {
|
|
21
13
|
* // "name": "John",
|
|
22
|
-
* // "age": 30,
|
|
23
14
|
* // "hobbies": [
|
|
24
15
|
* // "reading",
|
|
25
16
|
* // "gaming"
|
|
26
17
|
* // ]
|
|
27
18
|
* // }
|
|
28
|
-
|
|
29
|
-
* const invalidJsonString = '{"name":"John", "age":30,';
|
|
30
|
-
* const formatted = formatJsonString(invalidJsonString);
|
|
31
|
-
* console.log(formatted);
|
|
32
|
-
* // Output:
|
|
33
|
-
* // (Logs "Invalid JSON string: ..." to the console)
|
|
34
|
-
* // ""
|
|
35
19
|
* ```
|
|
36
20
|
*/
|
|
37
21
|
declare const formatJsonString: FormatJsonStringFunction;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,33 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* This function takes a string and capitalizes the first letter of each word
|
|
5
|
-
* while the remaining letters are lowercase.
|
|
2
|
+
* Capitalizes the first letter of each word and lowercases the rest.
|
|
6
3
|
* Words are separated by spaces.
|
|
7
4
|
*
|
|
8
|
-
* @param sentence - The
|
|
9
|
-
* @returns The sentence
|
|
5
|
+
* @param sentence - The string to format.
|
|
6
|
+
* @returns The sentence with every word title-cased.
|
|
10
7
|
*
|
|
11
8
|
* @example
|
|
12
9
|
* ```typescript
|
|
13
|
-
* //
|
|
14
|
-
* formatToCapitalizeFirstWordLetter("
|
|
15
|
-
* // Returns: "Hello World"
|
|
16
|
-
*
|
|
17
|
-
* // With capitalized text.
|
|
18
|
-
* formatToCapitalizeFirstWordLetter("HELLO WORLD");
|
|
19
|
-
* // Returns: "Hello World"
|
|
20
|
-
*
|
|
21
|
-
* // With mixed text.
|
|
22
|
-
* formatToCapitalizeFirstWordLetter("hELLO WoRLd"); * // Returns: "Hello World"
|
|
23
|
-
*
|
|
24
|
-
* // With multiple words
|
|
25
|
-
* formatToCapitalizeFirstWordLetter("javascript is an amazing language");
|
|
26
|
-
* // Returns: "Javascript is an amazing language"
|
|
27
|
-
*
|
|
28
|
-
* // Empty string
|
|
29
|
-
* formatToCapitalizeFirstWordLetter("");
|
|
30
|
-
* // Returns: ""
|
|
10
|
+
* formatToCapitalizeFirstWordLetter("hello world"); // "Hello World"
|
|
11
|
+
* formatToCapitalizeFirstWordLetter("HELLO WORLD"); // "Hello World"
|
|
31
12
|
* ```
|
|
32
13
|
*/
|
|
33
14
|
declare function formatToCapitalizeFirstWordLetter(sentence: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCapitalizeFirstWordLetter.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCapitalizeFirstWordLetter.ts"],"names":[],"mappings":"AAAA
|
|
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,4 +1,3 @@
|
|
|
1
|
-
type FormatToCepFunction = (value: string) => string;
|
|
2
1
|
/**
|
|
3
2
|
* Formats a given string into a Brazilian postal code (CEP) format.
|
|
4
3
|
*
|
|
@@ -6,24 +5,17 @@ type FormatToCepFunction = (value: string) => string;
|
|
|
6
5
|
* and attempts to format it as a CEP in the pattern `XXXXX-XXX`.
|
|
7
6
|
* If the input does not match the expected format, an error is thrown.
|
|
8
7
|
*
|
|
9
|
-
* @param value -
|
|
8
|
+
* @param value - Input string with 8 numeric digits (special characters are stripped).
|
|
10
9
|
* @returns The formatted CEP string in the pattern `XXXXX-XXX`.
|
|
10
|
+
*
|
|
11
11
|
* @throws {Error} If the input does not match the expected CEP format.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
* import { formatToCep } from "./formatToCep";
|
|
16
|
-
*
|
|
17
15
|
* const formattedCep = formatToCep("12345678");
|
|
18
16
|
* console.log(formattedCep); // Output: "12345-678"
|
|
19
|
-
*
|
|
20
|
-
* try {
|
|
21
|
-
* formatToCep("1234");
|
|
22
|
-
* } catch (error) {
|
|
23
|
-
* console.error(error.message); // Output: "Invalid CEP format"
|
|
24
|
-
* }
|
|
25
17
|
* ```
|
|
26
18
|
*/
|
|
27
|
-
declare
|
|
19
|
+
declare function formatToCep(value: string): string;
|
|
28
20
|
export { formatToCep };
|
|
29
21
|
//# sourceMappingURL=formatToCep.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCep.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCep.ts"],"names":[],"mappings":"AAEA,
|
|
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,30 +1,19 @@
|
|
|
1
|
-
type FormatToCnpjFunction = (value: string) => string;
|
|
2
1
|
/**
|
|
3
2
|
* Formats a given string or number into a CNPJ (Cadastro Nacional da Pessoa Jurídica) format.
|
|
4
3
|
*
|
|
5
4
|
* The CNPJ format is: `XX.XXX.XXX/XXXX-XX`, where `X` represents a digit.
|
|
6
5
|
*
|
|
7
|
-
* @param value -
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @returns A string formatted as a CNPJ.
|
|
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`.
|
|
11
8
|
*
|
|
12
9
|
* @throws {Error} Throws an error if the input does not contain exactly 14 numeric digits.
|
|
13
10
|
*
|
|
14
11
|
* @example
|
|
15
12
|
* ```typescript
|
|
16
|
-
* import { formatToCnpj } from "./formatToCNPJ";
|
|
17
|
-
*
|
|
18
13
|
* const formattedCnpj = formatToCnpj("12345678000195");
|
|
19
14
|
* console.log(formattedCnpj); // Output: "12.345.678/0001-95"
|
|
20
|
-
*
|
|
21
|
-
* try {
|
|
22
|
-
* formatToCnpj("12345");
|
|
23
|
-
* } catch (error) {
|
|
24
|
-
* console.error(error.message); // Output: "Invalid CNPJ length"
|
|
25
|
-
* }
|
|
26
15
|
* ```
|
|
27
16
|
*/
|
|
28
|
-
declare
|
|
17
|
+
declare function formatToCnpj(value: string): string;
|
|
29
18
|
export { formatToCnpj };
|
|
30
19
|
//# sourceMappingURL=formatToCnpj.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCnpj.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCnpj.ts"],"names":[],"mappings":"AAEA,
|
|
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,4 +1,3 @@
|
|
|
1
|
-
type FormatToCpfFunction = (value: string) => string;
|
|
2
1
|
/**
|
|
3
2
|
* Formats a given string into a CPF (Cadastro de Pessoas Físicas) format.
|
|
4
3
|
*
|
|
@@ -6,25 +5,17 @@ type FormatToCpfFunction = (value: string) => string;
|
|
|
6
5
|
* This function ensures the input is cleaned of non-numeric characters and
|
|
7
6
|
* then formats it into the standard CPF format: `XXX.XXX.XXX-XX`.
|
|
8
7
|
*
|
|
9
|
-
* @param value -
|
|
10
|
-
* @returns The formatted CPF string.
|
|
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
11
|
* @throws {Error} If the input string does not match the expected CPF format.
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
* import { formatToCpf } from "./formatToCPF";
|
|
16
|
-
*
|
|
17
15
|
* const formattedCpf = formatToCpf("12345678909");
|
|
18
16
|
* console.log(formattedCpf); // Output: "123.456.789-09"
|
|
19
|
-
|
|
20
|
-
* try {
|
|
21
|
-
* const formattedCpf = formatToCpf("12345");
|
|
22
|
-
* } catch (error) {
|
|
23
|
-
* console.error(error.message); // Output: "Invalid CPF format"
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
17
|
* ```
|
|
27
18
|
*/
|
|
28
|
-
declare
|
|
19
|
+
declare function formatToCpf(value: string): string;
|
|
29
20
|
export { formatToCpf };
|
|
30
21
|
//# sourceMappingURL=formatToCpf.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToCpf.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCpf.ts"],"names":[],"mappings":"AAEA,
|
|
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,34 +1,21 @@
|
|
|
1
1
|
import { countryCurrencies } from "@arkyn/templates";
|
|
2
2
|
type Currencies = keyof typeof countryCurrencies;
|
|
3
|
-
type Config = {
|
|
4
|
-
showPrefix?: boolean;
|
|
5
|
-
};
|
|
6
|
-
type FormatToCurrency = (value: number, currency: Currencies, config?: Config) => string;
|
|
7
3
|
/**
|
|
8
|
-
* Formats a
|
|
9
|
-
*
|
|
10
|
-
* @param value - The numeric value to be formatted.
|
|
11
|
-
* @param currency - The currency code used to determine the formatting style.
|
|
12
|
-
* @param config - Optional configuration object.
|
|
13
|
-
* @param config.showPrefix - Determines whether the currency symbol/prefix should be included in the formatted string. Defaults to `true`.
|
|
4
|
+
* Formats a number into a locale-aware currency string using `Intl.NumberFormat`.
|
|
14
5
|
*
|
|
15
|
-
* @
|
|
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.
|
|
16
10
|
*
|
|
17
11
|
* @example
|
|
18
12
|
* ```typescript
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* const withoutPrefix = formatToCurrency(1234.56, "USD", { showPrefix: false });
|
|
23
|
-
* console.log(withoutPrefix); // "1,234.56"
|
|
24
|
-
*
|
|
25
|
-
* const formattedBRL = formatToCurrency(1234.56, "BRL", { showPrefix: true });
|
|
26
|
-
* console.log(formattedBRL); // "R$ 1.234,56"
|
|
27
|
-
*
|
|
28
|
-
* const withoutPrefixBRL = formatToCurrency(1234.56, "BRL", { showPrefix: false });
|
|
29
|
-
* console.log(withoutPrefixBRL); // "1.234,56"
|
|
13
|
+
* formatToCurrency(1234.56, "BRL"); // "R$ 1.234,56"
|
|
14
|
+
* formatToCurrency(1234.56, "USD", { showPrefix: false }); // "1,234.56"
|
|
30
15
|
* ```
|
|
31
16
|
*/
|
|
32
|
-
declare
|
|
17
|
+
declare function formatToCurrency(value: number, currency: Currencies, config?: {
|
|
18
|
+
showPrefix?: boolean;
|
|
19
|
+
}): string;
|
|
33
20
|
export { formatToCurrency };
|
|
34
21
|
//# sourceMappingURL=formatToCurrency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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,CACxB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,MAAM,CAiBR;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
type FormatToEllipsisFunction = (value: string, maxLength: number) => string;
|
|
2
1
|
/**
|
|
3
2
|
* Truncates a given text to a specified maximum length and appends an ellipsis ("...")
|
|
4
3
|
* if the text exceeds the maximum length.
|
|
5
4
|
*
|
|
6
5
|
* @param text - The input string to be truncated.
|
|
7
|
-
* @param maxLength -
|
|
8
|
-
* @returns The truncated string with
|
|
9
|
-
* or the original string if it does not.
|
|
6
|
+
* @param maxLength - Maximum allowed length before truncation.
|
|
7
|
+
* @returns The truncated string with `"..."` appended, or the original string if it fits.
|
|
10
8
|
* @example
|
|
9
|
+
* ```typescript
|
|
11
10
|
* const result = formatToEllipsis("Hello, world!", 5);
|
|
12
11
|
* console.log(result); // Output: "Hello..."
|
|
12
|
+
* ```
|
|
13
13
|
*/
|
|
14
|
-
declare
|
|
14
|
+
declare function formatToEllipsis(text: string, maxLength: number): string;
|
|
15
15
|
export { formatToEllipsis };
|
|
16
16
|
//# sourceMappingURL=formatToEllipsis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToEllipsis.d.ts","sourceRoot":"","sources":["../../src/formats/formatToEllipsis.ts"],"names":[],"mappings":"AAAA,
|
|
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,35 +1,24 @@
|
|
|
1
|
-
type FormatToHiddenDigitsFunction = (value: string, options: {
|
|
2
|
-
range?: number | [number, number];
|
|
3
|
-
hider?: string;
|
|
4
|
-
}) => string;
|
|
5
1
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* This function takes a string input and replaces digits within a specified range
|
|
9
|
-
* with a hiding character (e.g., "*"). Non-digit characters remain unchanged.
|
|
10
|
-
*
|
|
11
|
-
* @param value - The input string to be formatted.
|
|
12
|
-
* @param options - Configuration options for formatting.
|
|
13
|
-
* @param options.range - The range of digits to hide. It can be:
|
|
14
|
-
* - A single number (e.g., `3`), which hides the first `n` digits if positive,
|
|
15
|
-
* or the last `n` digits if negative.
|
|
16
|
-
* - A tuple `[start, end]` specifying the range of digits to hide (inclusive).
|
|
17
|
-
* - Defaults to `3`, hiding the first three digits.
|
|
18
|
-
* @param options.hider - The character used to hide digits. Defaults to `"*"`.
|
|
2
|
+
* Replaces specific digits in a string with a masking character, leaving non-digit characters unchanged.
|
|
19
3
|
*
|
|
20
|
-
* @
|
|
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.
|
|
21
12
|
*
|
|
22
13
|
* @example
|
|
23
14
|
* ```typescript
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* formatToHiddenDigits("123-456-7890", { range: 3 });
|
|
27
|
-
* // Output: "***-456-7890"
|
|
28
|
-
*
|
|
29
|
-
* formatToHiddenDigits("123-456-7890", { range: [4, 6], hider: "#" });
|
|
30
|
-
* // Output: "123-###-7890"
|
|
15
|
+
* formatToHiddenDigits("123-456-7890", { range: 3 }); // "***-456-7890"
|
|
16
|
+
* formatToHiddenDigits("123-456-7890", { range: [4, 6], hider: "#" }); // "123-###-7890"
|
|
31
17
|
* ```
|
|
32
18
|
*/
|
|
33
|
-
declare
|
|
19
|
+
declare function formatToHiddenDigits(value: string, options?: {
|
|
20
|
+
range?: number | [number, number];
|
|
21
|
+
hider?: string;
|
|
22
|
+
}): string;
|
|
34
23
|
export { formatToHiddenDigits };
|
|
35
24
|
//# sourceMappingURL=formatToHiddenDigits.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToHiddenDigits.d.ts","sourceRoot":"","sources":["../../src/formats/formatToHiddenDigits.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"formatToHiddenDigits.d.ts","sourceRoot":"","sources":["../../src/formats/formatToHiddenDigits.ts"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iBAAS,oBAAoB,CAC5B,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,GAC7D,MAAM,CAWR;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1,34 +1,22 @@
|
|
|
1
|
-
type FormatToPhoneFunction = (prop: string) => string;
|
|
2
1
|
/**
|
|
3
|
-
* Formats a phone number string
|
|
2
|
+
* Formats a phone number string according to the country mask defined in `@arkyn/templates`.
|
|
4
3
|
*
|
|
5
|
-
* The
|
|
6
|
-
*
|
|
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
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
*
|
|
10
|
-
* - "+55 32912345678"
|
|
11
|
-
* - "+1 1234567890"
|
|
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.
|
|
12
10
|
*
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
15
|
-
* @throws {Error} If the input phone number does not match the expected format.
|
|
16
|
-
* @throws {Error} If the country code or phone number is missing from the input string.
|
|
17
|
-
* @throws {Error} If the provided country code and prefix combination is invalid.
|
|
18
|
-
* @throws {Error} If the provided country code is invalid.
|
|
19
|
-
* @throws {Error} If the provided country code has a prefix but none is supplied in the input.
|
|
11
|
+
* @throws {Error} If the phone number is invalid or if no country mask is found for the parsed country.
|
|
20
12
|
*
|
|
21
13
|
* @example
|
|
22
14
|
* ```typescript
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* console.log(formattedPhone1); // Output: "(11) 91234-5678" (brazilian phone number format)
|
|
27
|
-
*
|
|
28
|
-
* const formattedPhone2 = formatToPhone("+1-123 4567890");
|
|
29
|
-
* console.log(formattedPhone2); // Output: "(123) 456-7890" (us phone number format)
|
|
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)
|
|
30
18
|
* ```
|
|
31
19
|
*/
|
|
32
|
-
declare
|
|
20
|
+
declare function formatToPhone(phoneNumber: string): string;
|
|
33
21
|
export { formatToPhone };
|
|
34
22
|
//# sourceMappingURL=formatToPhone.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatToPhone.d.ts","sourceRoot":"","sources":["../../src/formats/formatToPhone.ts"],"names":[],"mappings":"
|
|
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,15 +1,17 @@
|
|
|
1
|
-
type GenerateColorByStringFunction = (prop: string) => string;
|
|
2
1
|
/**
|
|
3
2
|
* Generates a hexadecimal color code based on the input string.
|
|
4
3
|
* The function creates a hash from the string and uses it to calculate
|
|
5
4
|
* RGB values, which are then converted to a hexadecimal color code.
|
|
6
5
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @returns A hexadecimal color code (e.g., "#a1b2c3") derived from the input string.
|
|
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
9
|
* @example
|
|
10
|
+
* ```typescript
|
|
10
11
|
* const color = generateColorByString("example");
|
|
11
12
|
* console.log(color); // Outputs a consistent hex color like "#5e8f9a"
|
|
13
|
+
* ```
|
|
12
14
|
*/
|
|
13
|
-
declare
|
|
15
|
+
declare function generateColorByString(rawString: string): string;
|
|
14
16
|
export { generateColorByString };
|
|
15
17
|
//# sourceMappingURL=generateColorByString.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateColorByString.d.ts","sourceRoot":"","sources":["../../src/generators/generateColorByString.ts"],"names":[],"mappings":"AAAA,
|
|
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,26 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generates a
|
|
2
|
+
* Generates a UUID in the specified version and output type.
|
|
3
3
|
*
|
|
4
|
-
* @param type -
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* @param format - The version of the UUID to generate. Can be:
|
|
8
|
-
* - `"v4"`: Generates a random UUID (version 4).
|
|
9
|
-
* - `"v7"`: Generates a time-ordered UUID (version 7).
|
|
10
|
-
* @returns The generated UUID in the specified type and format.
|
|
11
|
-
* - If `type` is `"text"`, a string representation of the UUID is returned.
|
|
12
|
-
* - If `type` is `"binary"`, a `Uint8Array` representation of the UUID is returned.
|
|
13
|
-
* @throws {Error} If an invalid `type` or `format` is provided.
|
|
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`.
|
|
14
7
|
*
|
|
15
8
|
* @example
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // Generate a version 7 UUID as binary
|
|
22
|
-
* const idBinaryV7 = generateId("binary", "v7");
|
|
23
|
-
* console.log(idBinaryV7); // Uint8Array([...])
|
|
9
|
+
* ```typescript
|
|
10
|
+
* generateId("text", "v4"); // "550e8400-e29b-41d4-a716-446655440000"
|
|
11
|
+
* generateId("binary", "v7"); // Uint8Array([...])
|
|
12
|
+
* ```
|
|
24
13
|
*/
|
|
25
14
|
declare function generateId(type: "text", format: "v4" | "v7"): string;
|
|
26
15
|
declare function generateId(type: "binary", format: "v4" | "v7"): Uint8Array;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateId.d.ts","sourceRoot":"","sources":["../../src/generators/generateId.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -9,9 +9,15 @@
|
|
|
9
9
|
* - Collapses multiple consecutive hyphens into a single hyphen.
|
|
10
10
|
* - Trims leading and trailing hyphens.
|
|
11
11
|
*
|
|
12
|
-
* @param
|
|
12
|
+
* @param rawString - The input string to be converted into a slug.
|
|
13
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
|
+
* ```
|
|
14
20
|
*/
|
|
15
|
-
declare function generateSlug(
|
|
21
|
+
declare function generateSlug(rawString: string): string;
|
|
16
22
|
export { generateSlug };
|
|
17
23
|
//# sourceMappingURL=generateSlug.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSlug.d.ts","sourceRoot":"","sources":["../../src/generators/generateSlug.ts"],"names":[],"mappings":"AAAA
|
|
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"}
|