Skip to content

Commit 44d2b4a

Browse files
committed
Ignore emoty text
1 parent 78ddea7 commit 44d2b4a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ module.exports = function (ary, src1, key1, src2, key2) {
88
var min = 1000
99
var len = array.length
1010
for (var counter = 0; counter < len; counter++) {
11-
var levScore = leven(src1, array[counter])
12-
if (levScore < min) min = levScore
11+
var val = array[counter]
12+
if (val && val.length && val.length > 0) {
13+
var levScore = leven(src1, array[counter])
14+
if (levScore < min) min = levScore
15+
}
1316
}
1417
return min
1518
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leven-sort",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "Simply sort by similarity, starring Levenshtein via leven",
55
"keywords": [
66
"sort",

0 commit comments

Comments
 (0)