@michaelroling/ts-library 1.0.5 → 1.0.7
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/prototype/string.js +13 -0
- package/dist/types/string.d.ts +9 -0
- package/package.json +22 -18
package/dist/prototype/string.js
CHANGED
|
@@ -32,6 +32,16 @@ const mrStringReplacer = function (valueToReplace) {
|
|
|
32
32
|
const mrFirstLetterToUpperCase = function () {
|
|
33
33
|
return this.slice(0, 1).toUpperCase() + this.slice(1);
|
|
34
34
|
};
|
|
35
|
+
const mrRemoveDuplicatedSpaces = function () {
|
|
36
|
+
return this.replace(/ {2,}/g, " ").trim();
|
|
37
|
+
};
|
|
38
|
+
const mrSingleQuotesToDoubleQuotes = function () {
|
|
39
|
+
// prettier-ignore
|
|
40
|
+
return this.mrReplaceAll("'", "\"");
|
|
41
|
+
};
|
|
42
|
+
const mrRemoveQuotes = function () {
|
|
43
|
+
return this.replace(/['"]/g, "");
|
|
44
|
+
};
|
|
35
45
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
36
46
|
const stringPrototypeMethods = [
|
|
37
47
|
["mrReplaceAll", mrReplaceAll],
|
|
@@ -40,6 +50,9 @@ const stringPrototypeMethods = [
|
|
|
40
50
|
["mrDecomposeText", mrDecomposeText],
|
|
41
51
|
["mrStringReplacer", mrStringReplacer],
|
|
42
52
|
["mrFirstLetterToUpperCase", mrFirstLetterToUpperCase],
|
|
53
|
+
["mrRemoveDuplicatedSpaces", mrRemoveDuplicatedSpaces],
|
|
54
|
+
["mrSingleQuotesToDoubleQuotes", mrSingleQuotesToDoubleQuotes],
|
|
55
|
+
["mrRemoveQuotes", mrRemoveQuotes],
|
|
43
56
|
];
|
|
44
57
|
for (const [name, fn] of stringPrototypeMethods) {
|
|
45
58
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
package/dist/types/string.d.ts
CHANGED
|
@@ -12,6 +12,12 @@ declare global {
|
|
|
12
12
|
mrStringReplacer: MrStringReplacer;
|
|
13
13
|
/** Converts the first letter of the string to uppercase. */
|
|
14
14
|
mrFirstLetterToUpperCase: MrFirstLetterToUpperCase;
|
|
15
|
+
/** Removes duplicate spaces from the string and trims it. */
|
|
16
|
+
mrRemoveDuplicatedSpaces: MrRemoveDuplicatedSpaces;
|
|
17
|
+
/** Replaces all single quotes in the string with double quotes. */
|
|
18
|
+
mrSingleQuotesToDoubleQuotes: MrSingleQuotesToDoubleQuotes;
|
|
19
|
+
/** Removes all single and double quotes from the string. */
|
|
20
|
+
mrRemoveQuotes: MrRemoveQuotes;
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -21,6 +27,9 @@ export type MrIsBooleanString = (this: string) => boolean;
|
|
|
21
27
|
export type MrDecomposeText = (this: string, first: string, second: string) => DecomposeTextReturnType;
|
|
22
28
|
export type MrStringReplacer = (this: string, valueToReplace: StringReplacerObj[]) => string;
|
|
23
29
|
export type MrFirstLetterToUpperCase = (this: string) => string;
|
|
30
|
+
export type MrRemoveDuplicatedSpaces = (this: string) => string;
|
|
31
|
+
export type MrSingleQuotesToDoubleQuotes = (this: string) => string;
|
|
32
|
+
export type MrRemoveQuotes = (this: string) => string;
|
|
24
33
|
|
|
25
34
|
export interface DecomposeTextReturnType {
|
|
26
35
|
startIndex: number;
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@michaelroling/ts-library",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"require": "./dist/index.js"
|
|
10
|
+
"default": "./dist/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts"
|
|
13
12
|
}
|
|
14
13
|
},
|
|
15
14
|
"publishConfig": {
|
|
@@ -17,21 +16,21 @@
|
|
|
17
16
|
},
|
|
18
17
|
"dependencies": {
|
|
19
18
|
"chai": "^6.2.2",
|
|
20
|
-
"esbuild": "^0.
|
|
21
|
-
"prettier": "3.8.
|
|
22
|
-
"rollup": "^4.
|
|
23
|
-
"typescript": "^
|
|
24
|
-
"vitest": "^4.
|
|
19
|
+
"esbuild": "^0.28.0",
|
|
20
|
+
"prettier": "3.8.1",
|
|
21
|
+
"rollup": "^4.60.1",
|
|
22
|
+
"typescript": "^6.0.2",
|
|
23
|
+
"vitest": "^4.1.3"
|
|
25
24
|
},
|
|
26
25
|
"devDependencies": {
|
|
27
|
-
"@eslint/js": "^
|
|
28
|
-
"@vitest/coverage-v8": "4.
|
|
29
|
-
"cpx2": "^8.0.
|
|
30
|
-
"eslint": "^
|
|
31
|
-
"globals": "^17.
|
|
26
|
+
"@eslint/js": "^10.0.1",
|
|
27
|
+
"@vitest/coverage-v8": "4.1.3",
|
|
28
|
+
"cpx2": "^8.0.2",
|
|
29
|
+
"eslint": "^10.2.0",
|
|
30
|
+
"globals": "^17.4.0",
|
|
32
31
|
"jiti": "^2.6.1",
|
|
33
|
-
"jsdom": "^
|
|
34
|
-
"typescript-eslint": "^8.
|
|
32
|
+
"jsdom": "^29.0.2",
|
|
33
|
+
"typescript-eslint": "^8.58.1"
|
|
35
34
|
},
|
|
36
35
|
"scripts": {
|
|
37
36
|
"test": "vitest",
|
|
@@ -56,5 +55,10 @@
|
|
|
56
55
|
"bugs": {
|
|
57
56
|
"url": "https://github.com/MiRo1310/ts-library/issues"
|
|
58
57
|
},
|
|
59
|
-
"homepage": "https://github.com/MiRo1310/ts-library#readme"
|
|
58
|
+
"homepage": "https://github.com/MiRo1310/ts-library#readme",
|
|
59
|
+
"resolutions": {
|
|
60
|
+
"picomatch": "^4.0.4",
|
|
61
|
+
"flatted": "^3.4.2",
|
|
62
|
+
"minimatch": "^10.2.3"
|
|
63
|
+
}
|
|
60
64
|
}
|