Skip to content

Commit 131ec01

Browse files
authored
Merge pull request #26 from pelias/fix-numeric-sorting-bug
fix numeric sorting bug
2 parents 8c9d37b + 65df445 commit 131ec01

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ function resolveByFocusPointThenOtherField(isLayer, field, result1, result2, foc
8484
}
8585

8686
// no focus point, so on another field (currently only population or popularity)
87-
return result2[field] - result1[field];
87+
// note: (undefined-undefined==NaN) which is not an acceptable comparitor value
88+
return _.defaultTo(result2[field], 0) - _.defaultTo(result1[field], 0);
8889

8990
}
9091

0 commit comments

Comments
 (0)