Skip to content

Commit

Permalink
tiny refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Oct 7, 2021
1 parent 4b1b963 commit 781a2aa
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions x-pack/plugins/ml/public/application/util/index_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ export function getIndexPatternNames() {
}

export function getIndexPatternIdFromName(name: string) {
for (let j = 0; j < indexPatternCache.length; j++) {
if (indexPatternCache[j].title === name) {
return indexPatternCache[j].id;
}
}
return null;
return indexPatternCache.find((i) => i.title === name)?.id ?? null;
}
export interface IndexPatternAndSavedSearch {
savedSearch: SavedSearchSavedObject | null;
Expand Down

0 comments on commit 781a2aa

Please sign in to comment.