summaryrefslogtreecommitdiffstats
path: root/assets/js/search.js
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-04 18:55:15 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-04 18:55:15 +0200
commitae0ac2c3e4932bcef576ffc7f568b0685468c950 (patch)
treef170812f006dfd55d0d8e4b64e4257b50cb5ae5b /assets/js/search.js
parentd93a75b615b36fdf2275f10cf85b7812a06ec048 (diff)
downloadgohugo-theme-ed-ae0ac2c3e4932bcef576ffc7f568b0685468c950.tar.gz
Correct code style
Diffstat (limited to 'assets/js/search.js')
-rw-r--r--assets/js/search.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/assets/js/search.js b/assets/js/search.js
index c261586..1f8fedb 100644
--- a/assets/js/search.js
+++ b/assets/js/search.js
@@ -21,7 +21,7 @@ async function initSearchIndex() {
try {
const response = await fetch('/index.json');
pagesIndex = await response.json();
- searchIndex = lunr(function () {
+ searchIndex = lunr(function () { // eslint-disable-line no-undef
this.field('title');
this.field('categories');
this.field('tags');
@@ -238,7 +238,7 @@ function chunkify(input, chunkSize) {
if (lastChunkIsUneven && i === totalChunks - 1) {
end = input.length;
}
- output += input.slice(start, end) + " ";
+ output += input.slice(start, end) + ' ';
}
return output;
}
@@ -266,17 +266,16 @@ function ellipsize(input, maxLength) {
if (words.length <= maxLength) {
return input;
}
- return input.slice(0, words[maxLength].end) + "...";
+ return input.slice(0, words[maxLength].end) + '...';
}
if (!String.prototype.matchAll) {
String.prototype.matchAll = function (regex) {
- "use strict";
function ensureFlag(flags, flag) {
return flags.includes(flag) ? flags : flags + flag;
}
function* matchAll(str, regex) {
- const localCopy = new RegExp(regex, ensureFlag(regex.flags, "g"));
+ const localCopy = new RegExp(regex, ensureFlag(regex.flags, 'g'));
let match;
while ((match = localCopy.exec(str))) {
match.index = localCopy.lastIndex - match[0].length;