File tree Expand file tree Collapse file tree 1 file changed +0
-10
lines changed Expand file tree Collapse file tree 1 file changed +0
-10
lines changed Original file line number Diff line number Diff line change @@ -3,21 +3,17 @@ import {makeNormalizer} from './matches'
3
3
const initializeDpTable = ( rows , columns ) => {
4
4
const dp = Array ( rows + 1 )
5
5
. fill ( )
6
-
7
6
. map ( ( ) => Array ( columns + 1 ) . fill ( ) )
8
7
9
8
// fill rows
10
-
11
9
for ( let i = 0 ; i <= rows ; i ++ ) {
12
10
dp [ i ] [ 0 ] = i
13
11
}
14
12
15
13
// fill columns
16
-
17
14
for ( let i = 0 ; i <= columns ; i ++ ) {
18
15
dp [ 0 ] [ i ] = i
19
16
}
20
-
21
17
return dp
22
18
}
23
19
@@ -32,9 +28,7 @@ export const calculateLevenshteinDistance = (text1, text2) => {
32
28
dp [ row ] [ column ] =
33
29
Math . min (
34
30
dp [ row - 1 ] [ column - 1 ] ,
35
-
36
31
dp [ row ] [ column - 1 ] ,
37
-
38
32
dp [ row - 1 ] [ column ] ,
39
33
) + 1
40
34
}
@@ -47,11 +41,8 @@ const MAX_LEVENSHTEIN_DISTANCE = 4
47
41
48
42
export const getCloseMatchesByAttribute = (
49
43
attribute ,
50
-
51
44
container ,
52
-
53
45
searchText ,
54
-
55
46
{ collapseWhitespace, trim, normalizer} = { } ,
56
47
) => {
57
48
const matchNormalizer = makeNormalizer ( { collapseWhitespace, trim, normalizer} )
@@ -91,6 +82,5 @@ export const getCloseMatchesByAttribute = (
91
82
}
92
83
closestValues . push ( normalizedText )
93
84
}
94
-
95
85
return closestValues
96
86
}
You can’t perform that action at this time.
0 commit comments