Skip to content

Commit

Permalink
fix: check char strings
Browse files Browse the repository at this point in the history
  • Loading branch information
selmi-karim committed May 30, 2020
1 parent a32f889 commit 4e52b05
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const twoStrings = (sa1, sa2) => {
// Comparison should not check case or whitespace
let s1 = sa1.replace(/\s/g, "").toLowerCase();
let s2 = sa2.replace(/\s/g, "").toLowerCase();

if(s1.length === 1 || s2.length === 1) return Number(s1 === s2)
const similarity_num = 2 * intersect(pairs(s1), pairs(s2)).length;
const similarity_den = pairs(s1).length + pairs(s2).length;
return similarity_num / similarity_den;
Expand Down

0 comments on commit 4e52b05

Please sign in to comment.