mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Improve JS function itemTypeFromName code a bit
This commit is contained in:
parent
5919f62cf6
commit
d505c5abe4
@ -142,13 +142,11 @@ function initSearch(rawSearchIndex) {
|
||||
}
|
||||
|
||||
function itemTypeFromName(typename) {
|
||||
for (let i = 0, len = itemTypes.length; i < len; ++i) {
|
||||
if (itemTypes[i] === typename) {
|
||||
return i;
|
||||
}
|
||||
const index = itemTypes.findIndex(i => i === typename);
|
||||
if (index < 0) {
|
||||
throw new Error("Unknown type filter `" + typename + "`");
|
||||
}
|
||||
|
||||
throw new Error("Unknown type filter `" + typename + "`");
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user