Remove redundant type checking validation
This commit is contained in:
@@ -338,10 +338,9 @@ function validateLabel(label) {
|
||||
}
|
||||
|
||||
function validateTags(tags) {
|
||||
if (!Array.isArray(tags)) return new AppsError(AppsError.BAD_FIELD, 'tags must be an array of strings', { field: 'tags' });
|
||||
if (tags.length > 64) return new AppsError(AppsError.BAD_FIELD, 'Can only set up to 64 tags', { field: 'tags' });
|
||||
|
||||
if (tags.some(tag => (!tag || typeof tag !== 'string'))) return new AppsError(AppsError.BAD_FIELD, 'tags must be an array of non-empty strings', { field: 'tags' });
|
||||
if (tags.some(tag => tag.length == 0)) return new AppsError(AppsError.BAD_FIELD, 'tag cannot be empty', { field: 'tags' });
|
||||
if (tags.some(tag => tag.length > 128)) return new AppsError(AppsError.BAD_FIELD, 'tag must be less than 128', { field: 'tags' });
|
||||
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user