Skip to content

Commit

Permalink
Small change to more idiomatic typescript (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman authored Nov 9, 2020
1 parent 199b4cd commit 89aa853
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export default ({
const errors = [];

if (typeof value === 'string') {
const lowercaseCount = (value.match(/[a-z]/g) || []).length;
const upperCaseCount = (value.match(/[A-Z]/g) || []).length;
const numericCount = (value.match(/[0-9]/g) || []).length;
const symbolCount = (value.match(/[^a-zA-Z0-9]/g) || []).length;
const lowercaseCount = value.match(/[a-z]/g)?.length ?? 0;
const upperCaseCount = value.match(/[A-Z]/g)?.length ?? 0;
const numericCount = value.match(/[0-9]/g)?.length ?? 0;
const symbolCount = value.match(/[^a-zA-Z0-9]/g)?.length ?? 0;

const meetsMin = min && value.length >= min;
const meetsMax = max && value.length <= max;
Expand Down

0 comments on commit 89aa853

Please sign in to comment.