sfilter
v1.0.2
Published
SFilter is lightweight (1.5KB) javascript library for searching through array with fault tolerant.
Readme
SFilterJS
SFilter is lightweight (1.5KB) javascript library for searching through array with fault tolerant.
Example
<script src="/dist/sfilter.js"></script>
<script>
SFilter.setResources(["Javascript", "Hack-lang", "Go-lang", "Coffeescript", "PHP", "Ruby", "Swift", "Python", "Perl", "Java", "Scala", "Clojure", "Erlang", "Elixir", "C", "C++", "C#"]);
SFilter.find("jvscript");
// Return should be ["Javascript", "Coffeescript", "Swift", "C", "Java"]
// Sorted by most similar words
</script>Installation
using NPM
npm install sfilter --saveOn NodeJS you have to initialize the SFilter object before you can use it.
var sfilter = new SFilter();
sfilter.setResource(["a","b"]);using Browser
git clone [email protected]:alileza/sfilter.git
cd sfilter
open example.htmlDocs
Set Resources
Array list is called as Resources, for the array of object will be supported soon.
// all resources must be string, and not an object
SFilter.setResources(["Javascript", "Hack-lang", "Go-lang"]);Set Limit
Limit the response of SFilter find
// Set response limit
SFilter.setLimit(2);Find
Find similar string on the resources
// Get the response
SFilter.find("Jvscrpth");Test
coming soon
