consider rewriting this section using `some`
Opened this issue · 0 comments
DogeThis commented
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some
For example (untested code, as I didn't inspect what each type of the response is) (you can add "includes" if you want)
let keys_to_try = ['service_request_id', 'service_name', 'status', 'address'];
let matched = keys_to_try.some(function(key) {
return (String(ret[i][key]) == String(serviceRequestNumber).toLowerCase());
}
matched = matched || String(serviceRequestNumber).toLowerCase() == 'all'; // the weird case
if (matched) {
... something