Skip to content

Instantly share code, notes, and snippets.

@oschettler
Created August 21, 2018 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oschettler/3feab52a24bf93725a2b8beb0b2acf3b to your computer and use it in GitHub Desktop.
Save oschettler/3feab52a24bf93725a2b8beb0b2acf3b to your computer and use it in GitHub Desktop.
if (
recipePositionWithinSearchResult <= this.attributes.searchResults.length
) {
recipeSearchItem = this.attributes.searchResults[
recipePositionWithinSearchResult - 1
].recipe;
this.attributes.recipeSearchItem = recipeSearchItem;
this.attributes.recipePosition = recipePositionWithinSearchResult - 1;
} else {
let message;
if (typeof this.attributes.searchResults.length === 'undefined') {
message = this.t("DETAIL_OPEN_INDEX_NO_SEARCH_RESULT_ERROR");
}
else {
message = this.t(
"DETAIL_OPEN_INDEX_OUT_OF_BOUND_ERROR",
this.attributes.searchResults.length
);
}
this.emit(
":ask",
message,
message
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment