-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement more native API and remove legacy dependency (#22)
* Implement match(), wrap() natively. * Do not support prepareQuery(), since it only precomputes something for query which is not a major optimization. * Remove fuzzaldrin-plus dependency for prod (still depends on for dev/tests).
- Loading branch information
1 parent
cde1276
commit 204b0f4
Showing
9 changed files
with
368 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const path = require('path') | ||
const { | ||
wrap | ||
} = require('../fuzzaldrin-dist') | ||
const legacy = require('fuzzaldrin-plus') | ||
|
||
describe("wrap(string, query)", () => { | ||
const candidates = [ | ||
"helloworld", "Helloworld", "HelloWorld", | ||
"hello world", "Hello world", "Hello World", | ||
path.join("hello", "world"), | ||
] | ||
const queries = [ | ||
"he", "hl", "hw", "el", "eo", "ll", "wo", "ld", "", "helloworld", | ||
] | ||
it("returns same for hello world", () => { | ||
for (const c of candidates) { | ||
for (const q of queries) { | ||
expect(wrap(c, q)).toEqual(legacy.wrap(c, q)) | ||
} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.