Fork me on GitHub
download zip download tar

string_score by joshaven

JavaScript string ranking... "String".score("str"); //=> 0.825

Sample

Try me:
" ".score(" "); //=>

Or play with my fuzziness:
" ".score(" ", ); //=>

Fuzzyness should be between 0 and 1. Low fuzziness like 0.01 means a mismatch will drop the score more then a fuzziness of something like 0.9.

Dependencies

Any modern bower, NodeJS, or other JavaScript interpreter.

Install

If your using node.js then install with NPM and require...

Install with node.js from your terminal.

npm install --save string_score

Require string_score from inside of your app.

require('string_score');

If your using string_score inside of a browser

Simply include one of the string score JavaScript files and call the .score() method on any string.

I recommend using string_score.min.js (520 bytes) because it is small. The full file string_score.js (2868 bytes) includes comments and full variable names but is otherwise the same as the minified version.

The string_score file is hosted on CDNJS.com and can be included with the following in your page:

<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/string_score/0.1.10/string_score.min.js"></script>

Ports

View Ports on Github

License

MIT license: http://www.opensource.org/licenses/mit-license.php

Authors

Contact

If you expect that something is not right with this project, please Submit an Issue.

If your having trouble feel free to email me: Joshaven Potter ([email protected])

Download Options

You can use wget to download the current min version (less then a half of a kilobyte)

$ wget https://github.com/joshaven/string_score/raw/master/string_score.min.js

You can use curl to download the current min version (less then a half of a kilobyte)

$ curl -O https://github.com/joshaven/string_score/raw/master/string_score.min.js

If you want to modify the project, you could also clone the whole project with Git by running:

$ git clone git://github.com/joshaven/string_score

You could also download the whole project in either zip or tar formats.