string-comp

This package will allow a user to compare strings and see how well they match.

Usage no npm install needed!

<script type="module">
  import stringComp from 'https://cdn.skypack.dev/string-comp';
</script>

README

string_comp

This package will allow a user to compare strings and see how well they match.

The Package will also allow a user to see the percentage of the match that was found. It's a little bit of a fuzzy search.

var string_comp = require("string-comp");

var percentage = string_comp.percentage;
var compare = string_comp.compare;


compare("hello world","Hell no world",function(collection){
  console.log(collection);
  //[ 'Hell', 'o world' ]
});


percentage("hello world","Hell no world",function(percentage){
  console.log(percentage);
  //100
})

It might seem confusing that the result is 100% but the reason for this is that the second string contains all of the characters of the first in the correct order as well

So it gets a 100% match.

This is useful to parse things such as file names to see if a potential file might exist.

The reason that this is done async is because it can be processor intensive if you are comparing alot of strings. This way this is non blocking. Each iteration is set to be completed in an async way. That way a server can still be responsive while doing the comparison.