Skip to content

Commit 51a9b47

Browse files
committed
refactor(davinci-client): simplify maxRepeatedCharacters and remove redundant casts
1 parent ba9e945 commit 51a9b47

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

packages/davinci-client/src/lib/client.store.effects.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,9 @@ function continuePollingµ(
299299
mode: Extract<PollingMode, { _tag: 'continue' }>,
300300
): Effect.Effect<PollingStatus, InternalErrorResponse> {
301301
if (mode.retriesRemaining <= 0) {
302-
return Effect.succeed('timedOut' as PollingStatus);
302+
return Effect.succeed('timedOut');
303303
}
304-
return delayMs(mode.pollInterval).pipe(Effect.map(() => 'continue' as PollingStatus));
304+
return delayMs(mode.pollInterval).pipe(Effect.map(() => 'continue'));
305305
}
306306

307307
/**

packages/davinci-client/src/lib/password-policy.rules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const maxRepeatedCharactersRule: PasswordPolicyRule = (policy, value) => {
5252
const maxCount = pipe(
5353
countChars(value),
5454
(counts) => Array.from(counts.values()),
55-
Arr.reduce(0, (acc, n) => (n > acc ? n : acc)),
55+
(values) => Math.max(0, ...values),
5656
);
5757
return maxCount > max ? [`Password cannot repeat any character more than ${max} times`] : [];
5858
};

0 commit comments

Comments
 (0)