mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
sonarlint improvements
This commit is contained in:
@@ -7,17 +7,13 @@ export const validate = <T extends object>(
|
||||
options?: ValidateOption
|
||||
): Promise<T> =>
|
||||
new Promise((resolve, reject) => {
|
||||
void validator.validate(
|
||||
source,
|
||||
options ? options : {},
|
||||
(errors, fieldErrors) => {
|
||||
if (errors) {
|
||||
reject(fieldErrors as Error);
|
||||
} else {
|
||||
resolve(source as T);
|
||||
}
|
||||
void validator.validate(source, options || {}, (errors, fieldErrors) => {
|
||||
if (errors) {
|
||||
reject(fieldErrors as Error);
|
||||
} else {
|
||||
resolve(source as T);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
// updated to support both IPv4 and IPv6
|
||||
|
||||
Reference in New Issue
Block a user