node js : percentage based string compare

I need to compare 2 address in node js

For ex: 2 address

1)  100 MAIN ST,   PO BOX 1022, SEATTLE WA 98104,   USA
2) 101 MAIN ST,   PO BOX 1022, SEATTLE WA 98104,   USA  

should be treat as different address, but if we have

1)  100 MAIN ST,   PO BOX 1022, SEATTLE WA 98104,   USA
2) 100 MAIN ST,   PO BOX 1022, SEATTLA WA 98104,   USA  

should be treat as same address, and i need to throw error. Anyone have any idea how to do this.? is there any function in node js to accomplish this? Please help me to resolve it.

I can't speak for how successful this might be in practice, but you might consider looking into string comparison algorithms. In particular, algorithms that measure a 'distance' between two strings to see how similar they are.

One is the Levenshtein distance. Obviously you'd need to check this on a per-word basis and also be smart enough to know when you're looking at a house name or number (i.e. only consider words in the address that can tolerate typos).