Replaced use of flat() and max() math function for compatibility

This commit is contained in:
squidfunk
2022-01-06 20:26:34 +01:00
parent c45265d860
commit 0a25f757f4
7 changed files with 15 additions and 10 deletions

View File

@@ -27,6 +27,7 @@ import {
SearchResultItem
} from "~/integrations/search"
import { h, truncate } from "~/utilities"
import { ComponentChild, ComponentChildren } from "preact"
/* ----------------------------------------------------------------------------
* Helper types
@@ -61,8 +62,9 @@ function renderSearchDocument(
/* Render missing query terms */
const missing = Object.keys(document.terms)
.filter(key => !document.terms[key])
.map(key => [<del>{key}</del>, " "])
.flat()
.reduce<ComponentChild[]>((list, key) => [
...list, <del>{key}</del>, " "
], [])
.slice(0, -1)
/* Assemble query string for highlighting */