Skip to content

Commit 85274f9

Browse files
Extract encodeUri function to strings.ts and update references for better modularity.
1 parent 5cbd2f8 commit 85274f9

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/utils/image.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import type { Config, ImageParameters } from "../types/config";
22
import { hasComposer, hasNpm, hasYarn } from "./packageManagers";
3-
4-
const encodeUri = (value: string | undefined): string => {
5-
if (value === "" || value === undefined) {
6-
return "";
7-
}
8-
9-
return encodeURIComponent(value);
10-
};
3+
import { encodeUri } from './strings'
114

125
const detectPackageManager = (config: Config, visibility: string): string => {
136
if (hasComposer(config)) {

src/utils/strings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,11 @@ export const titleCase = (title: string | undefined) => {
99
.replace(/(^|\s|-|_)\S/g, (match: string) => match.toUpperCase())
1010
.replace(/[-_]/g, " ");
1111
};
12+
13+
export const encodeUri = (value: string | undefined): string => {
14+
if (value === "" || value === undefined) {
15+
return "";
16+
}
17+
18+
return encodeURIComponent(value);
19+
};

0 commit comments

Comments
 (0)