kumovega-instantsearch-adapter
Version:
Adapter to use InstantSearch UI widgets with Kumovega Search
16 lines (15 loc) • 488 B
JavaScript
export const utils = {
_adaptHighlightTag(value, highlightPreTag, highlightPostTag) {
return value
.replace(new RegExp("<mark>", "g"), highlightPreTag || "<mark>")
.replace(new RegExp("</mark>", "g"), highlightPostTag || "</mark>");
},
_adaptNumberOfPages() {
const result = this.kumovegaResponse.found / this.kumovegaResponse.request_params.per_page;
if (Number.isFinite(result)) {
return Math.ceil(result);
} else {
return 1;
}
},
};