Skip to content

Commit

Permalink
feat: rename item to hit in highlight utils
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Oct 26, 2020
1 parent 83a0e84 commit ab67a96
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions examples/js/app.ts
Expand Up @@ -4,7 +4,7 @@ import {
autocomplete,
AutocompleteSource,
getAlgoliaHits,
reverseHighlightItem,
reverseHighlightHit,
} from '@algolia/autocomplete-js';
import { createRecentSearchesPlugin } from '@algolia/autocomplete-plugin-recent-searches';
import '@algolia/autocomplete-plugin-recent-searches/style';
Expand Down Expand Up @@ -51,8 +51,8 @@ autocomplete<Hit<QuerySuggestionHit>>({
return `
<div class="item-icon">${searchIcon}</div>
<div>
${reverseHighlightItem({
item,
${reverseHighlightHit({
hit: item,
attribute: 'query',
})}
</div>
Expand Down
24 changes: 12 additions & 12 deletions packages/autocomplete-js/src/highlight.ts
Expand Up @@ -36,16 +36,16 @@ type HighlightItemParams<TItem> = {
/**
* Highlights and escapes the matching parts of an Algolia hit.
*/
export function highlightItem<TItem extends Hit<{}>>({
item,
export function highlightHit<TItem extends Hit<{}>>({
item: hit,
attribute,
highlightPreTag = '<mark>',
highlightPostTag = '</mark>',
ignoreEscape,
}: HighlightItemParams<TItem>) {
return concatParts(
parseAlgoliaHitHighlight<TItem>({
hit: item,
hit,
attribute,
ignoreEscape,
}),
Expand All @@ -58,16 +58,16 @@ export function highlightItem<TItem extends Hit<{}>>({
*
* This is a common pattern for Query Suggestions.
*/
export function reverseHighlightItem<TItem extends Hit<{}>>({
item,
export function reverseHighlightHit<TItem extends Hit<{}>>({
item: hit,
attribute,
highlightPreTag = '<mark>',
highlightPostTag = '</mark>',
ignoreEscape,
}: HighlightItemParams<TItem>) {
return concatParts(
parseAlgoliaHitReverseHighlight<TItem>({
hit: item,
hit,
attribute,
ignoreEscape,
}),
Expand All @@ -78,16 +78,16 @@ export function reverseHighlightItem<TItem extends Hit<{}>>({
/**
* Highlights and escapes the matching parts of an Algolia hit snippet.
*/
export function snippetItem<TItem extends Hit<{}>>({
item,
export function snippetHit<TItem extends Hit<{}>>({
item: hit,
attribute,
highlightPreTag = '<mark>',
highlightPostTag = '</mark>',
ignoreEscape,
}: HighlightItemParams<TItem>) {
return concatParts(
parseAlgoliaHitSnippet<TItem>({
hit: item,
hit,
attribute,
ignoreEscape,
}),
Expand All @@ -100,16 +100,16 @@ export function snippetItem<TItem extends Hit<{}>>({
*
* This is a common pattern for Query Suggestions.
*/
export function reverseSnippetItem<TItem extends Hit<{}>>({
item,
export function reverseSnippetHit<TItem extends Hit<{}>>({
item: hit,
attribute,
highlightPreTag = '<mark>',
highlightPostTag = '</mark>',
ignoreEscape,
}: HighlightItemParams<TItem>) {
return concatParts(
parseAlgoliaHitReverseSnippet<TItem>({
hit: item,
hit,
attribute,
ignoreEscape,
}),
Expand Down

0 comments on commit ab67a96

Please sign in to comment.