ambiguity text search for JavaScript
CoffeeScript JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
samples
src
tests
.gitignore
.npmignore
.travis.yml
Gruntfile.coffee
History.txt
README.md
asearch.min.js
package.json

README.md

Node Asearch

ambiguity text search for JavaScript

Build Status

Install

$ npm install asearch

Usage

Asearch = require 'asearch'

a = new Asearch 'abcde'

console.log a.match 'abcde'    # => true
console.log a.match 'AbCdE'    # => true
console.log a.match 'abcd'     # => false
console.log a.match 'abcd', 1  # => true
console.log a.match 'ab de', 1 # => true
console.log a.match 'abe', 1   # => false
console.log a.match 'abe', 2   # => true

Typo

a = new Asearch 'cheese burger'

console.log a.match 'cheese burger'   # => true
console.log a.match 'chess burger'    # => false
console.log a.match 'chess burger', 2 # => true
console.log a.match 'chess', 2        # => false

2 byte chars

a = new Asearch '漢字文字列'

console.log a.match '漢字文字列' # => true
console.log a.match '漢字文字烈' # => false
console.log a.match '漢字文字烈', 2 # => true

for browser

<script src="asearch.min.js"></script>
a = new Asearch('abcde');
a.match('abcd');

Test

$ git clone https://github.com/shokai/node-asearch.git
$ cd node-asearch
$ npm i
$ npm i -g grunt-cli
$ grunt test
$ grunt watch