deno.land / x / fuse@v6.4.1 / src / transform / transformMatches.js

transformMatches.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { 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) })}
fuse

Version Info

Tagged at
3 years ago