Skip to content

Commit

Permalink
fix(zap): add explicit return type for replaceAll
Browse files Browse the repository at this point in the history
  • Loading branch information
Im-Beast committed Jun 27, 2024
1 parent b686497 commit a4cc313
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/utils/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
export function replace(
string: string,
search: string,
replaceValue: string,
replaceValue: string
): string {
const searchIndex = string.indexOf(search);
if (searchIndex === -1) return string;
return string.slice(0, searchIndex) + replaceValue +
string.slice(searchIndex + search.length);
return (
string.slice(0, searchIndex) +
replaceValue +
string.slice(searchIndex + search.length)
);
}

/**
Expand All @@ -29,8 +32,8 @@ export function replace(
export function replaceAll(
string: string,
search: string,
replaceValue: string,
) {
replaceValue: string
): string {
let searchIndex = string.indexOf(search);
if (searchIndex === -1) return string;

Expand Down

0 comments on commit a4cc313

Please sign in to comment.