ismx-nexo-node-app 0.4.100 → 0.4.101
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/js/business/utils/StringUtils.js +18 -0
- package/dist/js/repository/RepositoryRest.js +1 -2
- package/dist/types/business/utils/StringUtils.d.ts +13 -0
- package/package.json +1 -1
- package/src/main/node/business/utils/StringUtils.ts +19 -0
- package/src/main/node/repository/RepositoryRest.ts +1 -1
|
@@ -23,9 +23,27 @@ class StringUtils {
|
|
|
23
23
|
result += chars.charAt(Math.floor(Math.random() * charactersLength));
|
|
24
24
|
return result;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Converts the first character of a given string to uppercase and returns the modified string.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} str - The string to be capitalized.
|
|
30
|
+
* @return {string} The input string with its first character converted to uppercase. If the input string is empty or null, it returns the original string.
|
|
31
|
+
*/
|
|
26
32
|
static capitalize(text) {
|
|
27
33
|
var _a;
|
|
28
34
|
return ((_a = text === null || text === void 0 ? void 0 : text.charAt(0)) === null || _a === void 0 ? void 0 : _a.toUpperCase()) + (text === null || text === void 0 ? void 0 : text.slice(1));
|
|
29
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Counts the number of words in the given string.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} str - The input string to be analyzed.
|
|
40
|
+
* @return {number} The total count of words found in the string.
|
|
41
|
+
*/
|
|
42
|
+
static countWords(str) {
|
|
43
|
+
if (str === null || str === undefined)
|
|
44
|
+
return 0;
|
|
45
|
+
const words = str.match(/\b[\p{L}\p{N}]+(?:'[\p{L}\p{N}]+)?\b/gu);
|
|
46
|
+
return words ? words.length : 0;
|
|
47
|
+
}
|
|
30
48
|
}
|
|
31
49
|
exports.default = StringUtils;
|
|
@@ -77,7 +77,6 @@ class RepositoryRest extends Repository_1.default {
|
|
|
77
77
|
RepositoryRest.defaultReviver = (key, value) => {
|
|
78
78
|
if (DateUtils_1.default.isIsoDate(value))
|
|
79
79
|
return new Date(value);
|
|
80
|
-
|
|
81
|
-
return value;
|
|
80
|
+
return value;
|
|
82
81
|
};
|
|
83
82
|
exports.default = RepositoryRest;
|
|
@@ -3,5 +3,18 @@ export default abstract class StringUtils {
|
|
|
3
3
|
static base64Encode(buffer: Buffer): string;
|
|
4
4
|
static base64UrlDecode(base64: string): Buffer;
|
|
5
5
|
static random(length: number, chars?: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Converts the first character of a given string to uppercase and returns the modified string.
|
|
8
|
+
*
|
|
9
|
+
* @param {string} str - The string to be capitalized.
|
|
10
|
+
* @return {string} The input string with its first character converted to uppercase. If the input string is empty or null, it returns the original string.
|
|
11
|
+
*/
|
|
6
12
|
static capitalize(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Counts the number of words in the given string.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} str - The input string to be analyzed.
|
|
17
|
+
* @return {number} The total count of words found in the string.
|
|
18
|
+
*/
|
|
19
|
+
static countWords(str: string): number;
|
|
7
20
|
}
|
package/package.json
CHANGED
|
@@ -26,7 +26,26 @@ export default abstract class StringUtils {
|
|
|
26
26
|
return result;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Converts the first character of a given string to uppercase and returns the modified string.
|
|
31
|
+
*
|
|
32
|
+
* @param {string} str - The string to be capitalized.
|
|
33
|
+
* @return {string} The input string with its first character converted to uppercase. If the input string is empty or null, it returns the original string.
|
|
34
|
+
*/
|
|
29
35
|
static capitalize(text: string): string {
|
|
30
36
|
return text?.charAt(0)?.toUpperCase() + text?.slice(1);
|
|
31
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Counts the number of words in the given string.
|
|
41
|
+
*
|
|
42
|
+
* @param {string} str - The input string to be analyzed.
|
|
43
|
+
* @return {number} The total count of words found in the string.
|
|
44
|
+
*/
|
|
45
|
+
static countWords(str: string): number {
|
|
46
|
+
if (str === null || str === undefined) return 0;
|
|
47
|
+
const words = str.match(/\b[\p{L}\p{N}]+(?:'[\p{L}\p{N}]+)?\b/gu);
|
|
48
|
+
return words ? words.length : 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
32
51
|
}
|