Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create QuickScore class to replace createScorer() (#1)
* Add debug harness Remove debug statements from quick-score.js and move them to debug-statements.js. quick-score-debug.js reinserts the debug statements after reading in the source. Add a maxDifference param to scoreNearly(). * Add uppercase and word separator tests to improve coverage Add some tests to quick-score-test.js. * Replicate bugs in QSSense.m Deliberately introduce bugs in quick-score.js to replicate the scores produced by QSSense.m, as described here: quicksilver/Quicksilver#2450 Add hitmask test that replicates the results from TestQSSense.m. * Remove buggy lines from quick-score.js Update tests in quick-score.test.js with scores from the non-buggy code. Add zero scores and search ranges test suites. Add engines in package.json to require at least node 8.0, so that the eval() in the quick-score-debug.js works. * Convert to one var declaration per line Convert var to let declarations, and use default params. Add loop to quick-score-test.js that demonstrates increasing the search range. Don't show the discount score values that aren't being used currently. Change indent so it starts at a 1-based column 10. * Change how debug statements are inserted by quick-score-debug.js Search for strings in quick-score.js and insert the debug statements before or after them. Convert some lets to consts in quick-score.js. * Rename debug files Fix path to src/quick-score.js from debug-harness.js. Add debug npm script and repository link. * Convert some lets to consts Convert substr() calls to substring(). Add --runInBand and --env node to jest calls to try to speed it up. Add test-watch script. * Add rollup to build the library Switch to using import and export instead of require() in src files. Build files to lib/ and dist/. Add index.js to combine the files into a single export. Add babel config to package.json to transform modules when testing with jest, but not when building with rollup. Remove webpack. Switch to let and const in debug-harness.js. * Add minified output to dist Change filenames in dist to quick-score. Add rollup-plugin-babel-minify. * Simplify exports from index.js Add prepare script and files array to package.json. Added some info to README.md. * Fix prepare in package.json * Change lib UMD output to index.js * Add test for index.js Include dist and lib in the npm package. Indent package.json with spaces. * Add eslint Add pretest script. Export named quickScore and default. * 0.1.0 * Add score-array.js and test Add tabs.js for example data. Tweak eslint rules and change to tab-delimited. * Use for-loop instead of reduce() when scoring arrays Add another Tabs scoring test and refactor it. * Add default scoreArray() export to score-array.js Add a "qk" score test. Add beginning of some examples to README.md. * Make the scorer function default to quickScore * Add test for configuring individual scorers per key Add minimum node version to package.json. Collect coverage only from src/. * Add scoreKey to indicate which key had the high score * Remove default exports Update tests for index.js. * Rename some parameters * Check max() only once in addIndexesInRange() * Rename hits to matches * Switch to returning ranges in matches array Remove addIndexesToRange() function. Fix quick-score.test.js. and score-array.test.js. Fix array-element-newline eslint rule. * Add version that returns the same scores as the QuicKey algo * Add configOptions to scoreArray() * Refactor quickScore() to use a config object for calculating scores Lowercase the string and query once rather than on every substring search. Add config.js. Add QuicksilverConfig to score strings like the default Quicksilver algo. * Update quick-score.js with code from quickey-quick-score.js Clean up order of params in adjustRemainingScore(). Include exports from config in index.js. Update scoreArray() to not default the config to null, so that DefaultConfig gets used. Remove quickey-quick-score.js. Fix index.test.js with new arity for quickScore(). Update .eslintrc. * Return ignoredScore for empty queries Add a test for an empty query that returns 0.9. * Refactor QuickScoreConfig to extend BaseConfig Add useSkipReduction() method and emptyQueryScore to the config. Move constants into config object so they can be overridden. Use emptyQueryScore = 0 with the default config. Rename config() to createConfig(). Create a config from the configOptions in createScorer(). Fix zero score tests. Remove babel key from package.json. Add babel-plugin-external-helpers to avoid duplicate class call checks. Update eslintrc. * Add a comment * Tweak .eslintrc.js * Create QuickScore class to replace createScorer() Squashed commit of the following: commit 99c2915 Author: John Dunning <fw@johndunning.com> Date: Sat Sep 8 21:31:56 2018 -0700 Turn off linebreak-style rule commit 6709cd6 Author: John Dunning <fw@johndunning.com> Date: Sat Sep 8 21:21:33 2018 -0700 Refactor QuickScore Change QuickScore.score() to search(). Add setKeys() and default params to QuickScore. In createConfig(), don't create a new QuickScoreConfig if the param is an instance of Config, so that BaseConfig isn't affected. Make createConfig() available on quickScore(). Add more QuickScore tests. Add setup.js and utils.js. Get rid of default searchRange in getRangeOfSubstring(). Clean up package.json scripts. Add license to README.md. commit 9797460 Author: John Dunning <fw@johndunning.com> Date: Fri Sep 7 19:18:41 2018 -0700 Add badges to README.md commit e4ea4d1 Author: John Dunning <fw@johndunning.com> Date: Fri Sep 7 19:11:52 2018 -0700 Add npm install to .travis.yml commit db891c1 Author: John Dunning <john_dunning@yahoo.com> Date: Fri Sep 7 17:37:14 2018 -0700 Move scorer to QuickScore to avoid circular import Add .travis.yml. Add codecov.io support. commit 9e2bdaa Author: John Dunning <fw@johndunning.com> Date: Thu Sep 6 15:50:35 2018 -0700 Move scorer to config commit 5d99f3a Author: John Dunning <fw@johndunning.com> Date: Thu Sep 6 00:15:12 2018 -0700 Add QuickScore class Add QuickScore.test.js. Add babel key back to package.json so that the tests work again.
- Loading branch information