mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +00:00
schema: Convert _.find used as loop to for…of.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
committed by
Tim Abbott
parent
13b8bf830f
commit
29dbf8ec77
@@ -37,19 +37,12 @@ exports.check_array = function (var_name, val, checker) {
|
|||||||
return var_name + ' is not an array';
|
return var_name + ' is not an array';
|
||||||
}
|
}
|
||||||
|
|
||||||
let msg;
|
for (const item of val) {
|
||||||
|
const msg = checker('item', item);
|
||||||
|
|
||||||
_.find(val, function (item) {
|
if (msg) {
|
||||||
const res = checker('item', item);
|
return 'in ' + var_name + ' we found an item where ' + msg;
|
||||||
|
|
||||||
if (res) {
|
|
||||||
msg = res;
|
|
||||||
return msg;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
if (msg) {
|
|
||||||
return 'in ' + var_name + ' we found an item where ' + msg;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user