@arkyn/shared 3.0.1-beta.2 → 3.0.1-beta.21
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/dist/formats/formatToCapitalizeFirstWordLetter.d.ts +35 -0
- package/dist/formats/formatToCapitalizeFirstWordLetter.d.ts.map +1 -0
- package/dist/formats/formatToCapitalizeFirstWordLetter.js +42 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/package.json +3 -4
- package/src/formats/formatToCapitalizeFirstWordLetter.ts +46 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a sentence by capitalizing the first letter of each word.
|
|
3
|
+
*
|
|
4
|
+
* This function takes a string and capitalizes the first letter of each word
|
|
5
|
+
* while the remaining letters are lowercase.
|
|
6
|
+
* Words are separated by spaces.
|
|
7
|
+
*
|
|
8
|
+
* @param sentence - The sentence to be formatted.
|
|
9
|
+
* @returns The sentence formatted with the first letter of each word capitalized.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Basic example
|
|
14
|
+
* formatToCapitalizeFirstWordLetter("hello world");
|
|
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: ""
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare function formatToCapitalizeFirstWordLetter(sentence: string): string;
|
|
34
|
+
export { formatToCapitalizeFirstWordLetter };
|
|
35
|
+
//# sourceMappingURL=formatToCapitalizeFirstWordLetter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatToCapitalizeFirstWordLetter.d.ts","sourceRoot":"","sources":["../../src/formats/formatToCapitalizeFirstWordLetter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,iBAAS,iCAAiC,CAAC,QAAQ,EAAE,MAAM,UAU1D;AAED,OAAO,EAAE,iCAAiC,EAAE,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a sentence by capitalizing the first letter of each word.
|
|
3
|
+
*
|
|
4
|
+
* This function takes a string and capitalizes the first letter of each word
|
|
5
|
+
* while the remaining letters are lowercase.
|
|
6
|
+
* Words are separated by spaces.
|
|
7
|
+
*
|
|
8
|
+
* @param sentence - The sentence to be formatted.
|
|
9
|
+
* @returns The sentence formatted with the first letter of each word capitalized.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Basic example
|
|
14
|
+
* formatToCapitalizeFirstWordLetter("hello world");
|
|
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: ""
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function formatToCapitalizeFirstWordLetter(sentence) {
|
|
34
|
+
const words = sentence.split(" ");
|
|
35
|
+
const capitalizedWords = words.map((word) => {
|
|
36
|
+
const firstLetter = word.charAt(0).toUpperCase();
|
|
37
|
+
const restOfWord = word.slice(1).toLowerCase();
|
|
38
|
+
return firstLetter + restOfWord;
|
|
39
|
+
});
|
|
40
|
+
return capitalizedWords.join(" ");
|
|
41
|
+
}
|
|
42
|
+
export { formatToCapitalizeFirstWordLetter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { formatDate } from "./formats/formatDate";
|
|
2
2
|
export { formatJsonObject } from "./formats/formatJsonObject";
|
|
3
3
|
export { formatJsonString } from "./formats/formatJsonString";
|
|
4
|
+
export { formatToCapitalizeFirstWordLetter } from "./formats/formatToCapitalizeFirstWordLetter";
|
|
4
5
|
export { formatToCep } from "./formats/formatToCep";
|
|
5
6
|
export { formatToCnpj } from "./formats/formatToCnpj";
|
|
6
7
|
export { formatToCpf } from "./formats/formatToCpf";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM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AW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export { formatDate } from "./formats/formatDate";
|
|
3
3
|
export { formatJsonObject } from "./formats/formatJsonObject";
|
|
4
4
|
export { formatJsonString } from "./formats/formatJsonString";
|
|
5
|
+
export { formatToCapitalizeFirstWordLetter } from "./formats/formatToCapitalizeFirstWordLetter";
|
|
5
6
|
export { formatToCep } from "./formats/formatToCep";
|
|
6
7
|
export { formatToCnpj } from "./formats/formatToCnpj";
|
|
7
8
|
export { formatToCpf } from "./formats/formatToCpf";
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkyn/shared",
|
|
3
|
-
"version": "3.0.1-beta.
|
|
3
|
+
"version": "3.0.1-beta.21",
|
|
4
4
|
"main": "./dist/bundle.js",
|
|
5
5
|
"module": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
|
-
"author": "Arkyn | Lucas Gonçalves",
|
|
10
9
|
"description": "Shared utilities and types for projects.",
|
|
11
10
|
"scripts": {
|
|
12
11
|
"clean": "rm -rf dist",
|
|
@@ -20,7 +19,7 @@
|
|
|
20
19
|
"devDependencies": {
|
|
21
20
|
"@types/uuid": "^10.0.0",
|
|
22
21
|
"bun-types": "latest",
|
|
23
|
-
"vitest": "^3.
|
|
24
|
-
"typescript": "^5.
|
|
22
|
+
"vitest": "^3.2.4",
|
|
23
|
+
"typescript": "^5.9.2"
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a sentence by capitalizing the first letter of each word.
|
|
3
|
+
*
|
|
4
|
+
* This function takes a string and capitalizes the first letter of each word
|
|
5
|
+
* while the remaining letters are lowercase.
|
|
6
|
+
* Words are separated by spaces.
|
|
7
|
+
*
|
|
8
|
+
* @param sentence - The sentence to be formatted.
|
|
9
|
+
* @returns The sentence formatted with the first letter of each word capitalized.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Basic example
|
|
14
|
+
* formatToCapitalizeFirstWordLetter("hello world");
|
|
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: ""
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function formatToCapitalizeFirstWordLetter(sentence: string) {
|
|
35
|
+
const words = sentence.split(" ");
|
|
36
|
+
|
|
37
|
+
const capitalizedWords = words.map((word) => {
|
|
38
|
+
const firstLetter = word.charAt(0).toUpperCase();
|
|
39
|
+
const restOfWord = word.slice(1).toLowerCase();
|
|
40
|
+
return firstLetter + restOfWord;
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return capitalizedWords.join(" ");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { formatToCapitalizeFirstWordLetter };
|
package/src/index.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
export { formatDate } from "./formats/formatDate";
|
|
3
3
|
export { formatJsonObject } from "./formats/formatJsonObject";
|
|
4
4
|
export { formatJsonString } from "./formats/formatJsonString";
|
|
5
|
+
export { formatToCapitalizeFirstWordLetter } from "./formats/formatToCapitalizeFirstWordLetter";
|
|
5
6
|
export { formatToCep } from "./formats/formatToCep";
|
|
6
7
|
export { formatToCnpj } from "./formats/formatToCnpj";
|
|
7
8
|
export { formatToCpf } from "./formats/formatToCpf";
|