Skip to content

Commit

Permalink
Correcting syntax of overloading (#3598)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
leog and kodiakhq[bot] committed Aug 2, 2022
1 parent 53de4dd commit 760026b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/lib/auth.ts
Expand Up @@ -19,7 +19,12 @@ export async function getSession(options: GetSessionParams): Promise<Session | n
return session as Session | null;
}

export const isPasswordValid = ((password: string, breakdown?: boolean) => {
export function isPasswordValid(password: string): boolean;
export function isPasswordValid(
password: string,
breakdown: boolean
): { caplow: boolean; num: boolean; min: boolean };
export function isPasswordValid(password: string, breakdown?: boolean) {
let cap = false, // Has uppercase characters
low = false, // Has lowercase characters
num = false, // At least one number
Expand All @@ -33,7 +38,4 @@ export const isPasswordValid = ((password: string, breakdown?: boolean) => {
}
}
return !!breakdown ? { caplow: cap && low, num, min } : cap && low && num && min;
}) as {
(password: string): boolean;
(password: string, breakdown: boolean): { caplow: boolean; num: boolean; min: boolean };
};
}

0 comments on commit 760026b

Please sign in to comment.