deno.land / x / fuse@v6.4.1 / src / transform / transformMatches.js
12345678910111213141516171819202122232425262728293031323334import { isDefined } from '../helpers/types'
export default function transformMatches(result, data) { const matches = result.matches data.matches = []
if (!isDefined(matches)) { return }
matches.forEach((match) => { if (!isDefined(match.indices) || !match.indices.length) { return }
const { indices, value } = match
let obj = { indices, value }
if (match.key) { obj.key = match.key.src }
if (match.idx > -1) { obj.refIndex = match.idx }
data.matches.push(obj) })}
Version Info