eslint: Fix unicorn/no-for-loop.

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/no-for-loop.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-10-07 01:41:58 -07:00
committed by Tim Abbott
parent 73a14bee6f
commit de791b82b6
6 changed files with 19 additions and 28 deletions

View File

@@ -215,15 +215,7 @@ function get_profile_field_info(id) {
}
function get_profile_field(id) {
const all_custom_fields = page_params.custom_profile_fields;
let field;
for (let i = 0; i < all_custom_fields.length; i += 1) {
if (all_custom_fields[i].id === id) {
field = all_custom_fields[i];
break;
}
}
return field;
return page_params.custom_profile_fields.find((field) => field.id === id);
}
exports.parse_field_choices_from_field_data = function (field_data) {