mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
This rule can be used to ensure that properties contain a minimum number of characters. PR Close #22759
8 lines
275 B
JavaScript
8 lines
275 B
JavaScript
module.exports = function createMinLengthRule(minLength) {
|
|
minLength = minLength || 2;
|
|
return (doc, prop, value) => {
|
|
if (value.length < minLength) {
|
|
return `Invalid "${prop}" property: "${value}". It must have at least ${minLength} characters.`;
|
|
}
|
|
};
|
|
};
|