Skip to content

Commit

Permalink
chore: remove pre-optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Apr 19, 2022
1 parent 6fa38fb commit 5f7e874
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/random.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,16 +557,9 @@ export class Random {

const { allowLeadingZeros = false, bannedDigits = [] } = options;

const joinedBannedDigits =
bannedDigits.length > 0
? Array.from(new Set([...bannedDigits]))
.filter((char) => /^[0-9]$/.test(char))
.join('')
: '';

const allowedDigits = '0123456789'
.split('')
.filter((digit) => !joinedBannedDigits.includes(digit));
.filter((digit) => !bannedDigits.includes(digit));

if (
allowedDigits.length === 0 ||
Expand Down

0 comments on commit 5f7e874

Please sign in to comment.