Skip to content

Commit 85b3f03

Browse files
committed
fix: rename str param
1 parent 369a986 commit 85b3f03

28 files changed

+122
-122
lines changed

scripts/string/at/default.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ export function at<
33
GenericIndex extends number,
44
>(
55
index: GenericIndex,
6-
): (string: GenericString) => string | undefined;
6+
): (input: GenericString) => string | undefined;
77

88
export function at<
99
GenericString extends string,
1010
GenericIndex extends number,
1111
>(
12-
string: GenericString,
12+
input: GenericString,
1313
index: GenericIndex,
1414
): string | undefined;
1515

1616
export function at(...args: [string, number] | [number]) {
1717
if (args.length === 1) {
1818
const [index] = args;
19-
return (string: string) => at(string, index);
19+
return (input: string) => at(input, index);
2020
}
2121

22-
const [string, index] = args;
22+
const [input, index] = args;
2323

24-
return string.at(index);
24+
return input.at(index);
2525
}

scripts/string/at/first.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import { type First } from "../types";
22

33
export function first<
44
GenericString extends string,
5-
>(string: GenericString): First<GenericString> {
6-
return string[0] as First<GenericString>;
5+
>(input: GenericString): First<GenericString> {
6+
return input[0] as First<GenericString>;
77
}

scripts/string/capitalize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export function capitalize<
22
GenericString extends string,
3-
>(str: GenericString) {
4-
return (str.charAt(0).toUpperCase() + str.slice(1)) as Capitalize<GenericString>;
3+
>(input: GenericString) {
4+
return (input.charAt(0).toUpperCase() + input.slice(1)) as Capitalize<GenericString>;
55
}

scripts/string/charAt.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
export function charAt(
22
index: number,
3-
): (str: string) => string;
3+
): (input: string) => string;
44

55
export function charAt(
6-
str: string,
6+
input: string,
77
index: number,
88
): string;
99

1010
export function charAt(...args: [string, number] | [number]): any {
1111
if (args.length === 1) {
1212
const [index] = args;
13-
return (str: string) => charAt(str, index);
13+
return (input: string) => charAt(input, index);
1414
}
1515

16-
const [str, index] = args;
16+
const [input, index] = args;
1717

18-
return str.charAt(index);
18+
return input.charAt(index);
1919
}

scripts/string/concat.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
export function concat(
22
text: string,
3-
): (str: string) => string;
3+
): (input: string) => string;
44

55
export function concat(
6-
str: string,
6+
input: string,
77
...textsRest: string[]
88
): string;
99

1010
export function concat(...args: [string, ...string[]] | [string]) {
1111
if (args.length === 1) {
1212
const [text] = args;
13-
return (str: string) => concat(str, text);
13+
return (input: string) => concat(input, text);
1414
}
1515

16-
const [str, ...textsRest] = args;
16+
const [input, ...textsRest] = args;
1717

18-
return str.concat(...textsRest);
18+
return input.concat(...textsRest);
1919
}

scripts/string/endsWith.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ export function endsWith<
55
length?: number,
66
): <
77
GenericString extends string,
8-
>(str: GenericString) => str is Extract<GenericString, `${string}${GenericSearchString}`>;
8+
>(input: GenericString) => input is Extract<GenericString, `${string}${GenericSearchString}`>;
99

1010
export function endsWith<
1111
GenericString extends string,
1212
GenericSearchString extends string,
1313
>(
14-
str: GenericString,
14+
input: GenericString,
1515
searchString: GenericSearchString,
1616
length?: number,
17-
): str is Extract<GenericString, `${string}${GenericSearchString}`>;
17+
): input is Extract<GenericString, `${string}${GenericSearchString}`>;
1818

1919
export function endsWith(...args: [string, string, number?] | [string, number?]): any {
2020
if (typeof args[0] === "string" && typeof args[1] !== "string") {
2121
const [searchString, length] = args;
22-
return (str: string) => endsWith(str, searchString, length);
22+
return (input: string) => endsWith(input, searchString, length);
2323
}
2424

25-
const [str, searchString, length] = args as [string, string, number?];
25+
const [input, searchString, length] = args as [string, string, number?];
2626

27-
return str.endsWith(searchString, length);
27+
return input.endsWith(searchString, length);
2828
}

scripts/string/includes.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ export function includes<
55
position?: number,
66
): <
77
GenericString extends string,
8-
>(str: GenericString) => str is Extract<GenericString, `${string}${GenericSearchString}${string}`>;
8+
>(input: GenericString) => input is Extract<GenericString, `${string}${GenericSearchString}${string}`>;
99

1010
export function includes<
1111
GenericString extends string,
1212
GenericSearchString extends string,
1313
>(
14-
str: GenericString,
14+
input: GenericString,
1515
searchString: GenericSearchString,
1616
position?: number,
17-
): str is Extract<GenericString, `${string}${GenericSearchString}${string}`>;
17+
): input is Extract<GenericString, `${string}${GenericSearchString}${string}`>;
1818

1919
export function includes(...args: [string, string, number?] | [string, number?]): any {
2020
if (typeof args[0] === "string" && typeof args[1] !== "string") {
2121
const [searchString, position] = args;
22-
return (str: string) => includes(str, searchString, position);
22+
return (input: string) => includes(input, searchString, position);
2323
}
2424

25-
const [str, searchString, position] = args as [string, string, number?];
25+
const [input, searchString, position] = args as [string, string, number?];
2626

27-
return str.includes(searchString, position);
27+
return input.includes(searchString, position);
2828
}

scripts/string/indexOf.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
export function indexOf(
22
searchString: string,
3-
): (str: string) => number | undefined;
3+
): (input: string) => number | undefined;
44

55
export function indexOf(
6-
str: string,
6+
input: string,
77
searchString: string,
88
position?: number,
99
): number | undefined;
1010

1111
export function indexOf(...args: [string, string, number?] | [string]): any {
1212
if (args.length === 1) {
1313
const [searchString] = args;
14-
return (str: string) => indexOf(str, searchString);
14+
return (input: string) => indexOf(input, searchString);
1515
}
1616

17-
const [str, searchString, position] = args;
17+
const [input, searchString, position] = args;
1818

19-
const result = str.indexOf(searchString, position);
19+
const result = input.indexOf(searchString, position);
2020
return result === -1 ? undefined : result;
2121
}

scripts/string/lastIndexOf.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
export function lastIndexOf(
22
searchString: string,
3-
): (str: string) => number | undefined;
3+
): (input: string) => number | undefined;
44

55
export function lastIndexOf(
6-
str: string,
6+
input: string,
77
searchString: string,
88
position?: number,
99
): number | undefined;
1010

1111
export function lastIndexOf(...args: [string, string, number?] | [string]): any {
1212
if (args.length === 1) {
1313
const [searchString] = args;
14-
return (str: string) => lastIndexOf(str, searchString);
14+
return (input: string) => lastIndexOf(input, searchString);
1515
}
1616

17-
const [str, searchString, position] = args;
17+
const [input, searchString, position] = args;
1818

19-
const result = str.lastIndexOf(searchString, position);
19+
const result = input.lastIndexOf(searchString, position);
2020
return result === -1 ? undefined : result;
2121
}

scripts/string/match.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
export function match(
22
pattern: string | RegExp,
3-
): (str: string) => RegExpMatchArray | undefined;
3+
): (input: string) => RegExpMatchArray | undefined;
44

55
export function match(
6-
str: string,
6+
input: string,
77
pattern: string | RegExp,
88
): RegExpMatchArray | undefined;
99

1010
export function match(...args: [string, string | RegExp] | [string | RegExp]): any {
1111
if (args.length === 1) {
1212
const [pattern] = args;
13-
return (str: string) => match(str, pattern);
13+
return (input: string) => match(input, pattern);
1414
}
1515

16-
const [str, pattern] = args;
16+
const [input, pattern] = args;
1717

18-
const result = str.match(pattern);
18+
const result = input.match(pattern);
1919

2020
return result ? result : undefined;
2121
}

0 commit comments

Comments
 (0)