Skip to content

Commit

Permalink
Added v2.2.0. Issue #6, #62
Browse files Browse the repository at this point in the history
  • Loading branch information
krisk committed Mar 7, 2016
1 parent fdb3c3e commit 38ae3ca
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Version 2.2.0-beta
# Version 2.2.0

- Added option to include matched indices (#6)
- Added ability to search with weighted keys (#62)

# Version 2.1.0-beta

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fuse.js",
"version": "2.2.0-beta",
"version": "2.2.0",
"main": "./src/fuse.js",
"ignore": [
"test"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fuse.js",
"author": "Kirollos Risk",
"version": "2.2.0-beta",
"version": "2.2.0",
"description": "Lightweight fuzzy-search",
"license": "Apache",
"main": "./src/fuse.js",
Expand Down
2 changes: 1 addition & 1 deletion src/fuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
}
}

Fuse.VERSION = '2.2.0-beta'
Fuse.VERSION = '2.2.0'

/**
* Sets a new list for Fuse to match against.
Expand Down
2 changes: 1 addition & 1 deletion src/fuse.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions test/fuse-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -745,3 +745,37 @@ vows.describe('Weighted search').addBatch({
}
}
}).export(module)

vows.describe('Search location').addBatch({
'Books:': {
topic: function () {
var items = [{
name: 'Hello World'
}]
var options = {
keys: ['name'],
verbose: verbose,
include: ['score', 'matches']
}
var fuse = new Fuse(items, options)
return fuse
},
'When searching for the term "wor"': {
topic: function (fuse) {
var result = fuse.search('wor')
return result
},
'we get a a non empty list': function (result) {
assert.isTrue(!!result.length)
},
'whose indices are found': function (result) {
var matches = result[0].matches
var a = matches[0].indices[0]
var b = matches[0].indices[1]
assert.deepEqual(a, [4, 4])
assert.deepEqual(b, [6, 8])
},
}
}
}).export(module)

0 comments on commit 38ae3ca

Please sign in to comment.