mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-06 15:31:16 +08:00
No need for double negation
This commit is contained in:
parent
ea0bda5646
commit
a4f6dd4e8e
@ -11,8 +11,8 @@ const validateArgs = (key = '', value: unknown): boolean => {
|
||||
if (key === '' || !VALIDATION_REGEXP.test(key)) return false;
|
||||
if (typeof value === 'number' || typeof value === 'boolean') return true;
|
||||
if (typeof value === 'string') return VALIDATION_REGEXP.test(value);
|
||||
if (Array.isArray(value)) return !value.some((v) => !validateArgs(key, v));
|
||||
if (isPlainObject(value)) return !Object.entries(value).some(([k, v]) => !validateArgs(k, v));
|
||||
if (Array.isArray(value)) return value.every((v) => validateArgs(key, v));
|
||||
if (isPlainObject(value)) return Object.entries(value).every(([k, v]) => validateArgs(k, v));
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -76,8 +76,8 @@ const validateArgs = (key = '', value: unknown): boolean => {
|
||||
if (key === '' || !VALIDATION_REGEXP.test(key)) return false;
|
||||
if (typeof value === 'number' || typeof value === 'boolean') return true;
|
||||
if (typeof value === 'string') return VALIDATION_REGEXP.test(value);
|
||||
if (Array.isArray(value)) return !value.some((v) => !validateArgs(key, v));
|
||||
if (isPlainObject(value)) return !Object.entries(value).some(([k, v]) => !validateArgs(k, v));
|
||||
if (Array.isArray(value)) return value.every((v) => validateArgs(key, v));
|
||||
if (isPlainObject(value)) return Object.entries(value).every(([k, v]) => validateArgs(k, v));
|
||||
return false;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user