_comuns/dist-esm/texto_busca.js
2024-05-07 10:00:00 -03:00

11 lines
418 B
JavaScript

/** gerar o texto de busca removendo caracteres especies e caixa alta */
export const texto_busca = (...texto) => texto
.map((txt) => txt === null || txt === undefined
? ""
: String(txt)
.normalize("NFD")
// biome-ignore lint/suspicious/noMisleadingCharacterClass: <explanation>
.replace(/[\u0300-\u036f]/g, "")
.replace(/\s+/g, " ")
.toLowerCase())
.join(" ");