Skip to content

Commit

Permalink
refactor: change patterns names
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilan Kushnir committed Nov 25, 2024
1 parent 9f740cb commit 8be39f1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/matchers/lowercaseMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export const lowercaseMatcher: Matcher = {
return matches;
}
}
matches.push({ pattern: 'oneLowercase', token: password, i: 0, j: password.length - 1 });
matches.push({ pattern: 'lowercaseRequired', token: password, i: 0, j: password.length - 1 });
return matches;
}
},
feedback: options => {
return {
warning: options.translations.warnings.oneLowercase || 'oneLowercase',
warning: options.translations.warnings.lowercaseRequired || 'lowercaseRequired',
suggestions: [],
};
},
Expand Down
4 changes: 2 additions & 2 deletions src/matchers/numberMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export const numberMatcher: Matcher = {
return matches;
}
}
matches.push({ pattern: 'oneNumber', token: password, i: 0, j: password.length - 1 });
matches.push({ pattern: 'numberRequired', token: password, i: 0, j: password.length - 1 });
return matches;
}
},
feedback: options => {
return {
warning: options.translations.warnings.oneNumber || 'oneNumber',
warning: options.translations.warnings.numberRequired || 'numberRequired',
suggestions: [],
};
},
Expand Down
4 changes: 2 additions & 2 deletions src/matchers/specialMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ export const specialMatcher: Matcher = {
return matches;
}
}
matches.push({ pattern: 'oneSpecial', token: password, i: 0, j: password.length - 1 });
matches.push({ pattern: 'specialRequired', token: password, i: 0, j: password.length - 1 });
return matches;
}
},
feedback: options => {
return {
warning: options.translations.warnings.oneSpecial || 'oneSpecial',
warning: options.translations.warnings.specialRequired || 'specialRequired',
suggestions: [],
};
},
Expand Down
4 changes: 2 additions & 2 deletions src/matchers/uppercaseMatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ export const uppercaseMatcher: Matcher = {
return matches;
}
}
matches.push({ pattern: 'oneUppercase', token: password, i: 0, j: password.length - 1 });
matches.push({ pattern: 'uppercaseRequired', token: password, i: 0, j: password.length - 1 });
return matches;
}
},
feedback: options => {
return {
warning: options.translations.warnings.oneUppercase || 'oneUppercase',
warning: options.translations.warnings.uppercaseRequired || 'uppercaseRequired',
suggestions: [],
};
},
Expand Down
8 changes: 4 additions & 4 deletions src/translations.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export const customMatchersTranslations = {
warnings: {
oneLowercase: 'Include at least one lowercase letter.',
lowercaseRequired: 'Include at least one lowercase letter.',
minLength: 'Password may not be shorter than ${minLength} characters.',
oneNumber: 'Include at least one number.',
oneSpecial: 'Include at least one special character.',
oneUppercase: 'Include at least one uppercase letter.',
numberRequired: 'Include at least one number.',
specialRequired: 'Include at least one special character.',
uppercaseRequired: 'Include at least one uppercase letter.',
},
suggestions: {},
timeEstimation: {},
Expand Down

0 comments on commit 8be39f1

Please sign in to comment.