{"name":"fuzzy","description":"small, standalone fuzzy search / fuzzy filter. browser or node","version":"0.1.2","homepage":"https://github.com/mattyork/fuzzy","author":{"name":"Matt York","email":"york.matt@gmail.com","url":"mattyork.org"},"repository":{"type":"git","url":"git://github.com/mattyork/fuzzy.git"},"bugs":{"url":"https://github.com/mattyork/fuzzy/issues"},"licenses":[{"type":"MIT","url":"https://github.com/mattyork/fuzzy/blob/master/LICENSE-MIT"}],"main":"lib/fuzzy","typings":"lib/fuzzy","engines":{"node":">= 0.6.0"},"scripts":{"test":"make test"},"devDependencies":{"mocha":">= 1.3.0","chai":">= 1.1.1","underscore":">= 1.3.3","uglify-js":">= 1.3.2","jshint":">= 0.7.1"},"keywords":["fuzzy","search","filter","sublime","sublime text"],"gitHead":"a66881f147b95f9c914fc8ef5229087dd844a738","_id":"fuzzy@0.1.2","_shasum":"08cdcab1207f559bb962cc80439402ead973a26d","_from":".","_npmVersion":"3.5.2","_nodeVersion":"5.1.1","_npmUser":{"name":"mattyork","email":"york.matt@gmail.com"},"dist":{"shasum":"08cdcab1207f559bb962cc80439402ead973a26d","tarball":"http://registry-npm.ywwl.com/fuzzy/download/fuzzy-0.1.2.tgz","integrity":"sha512-XB6vrgindL/4QCSc9cjQcT81xWvbu/jWFx9pxoliK7vGArwabXC77JOIdkiJRhAyN1Tky9Pli8D/r+s40Cqi0w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD2d0/BDWb3zIx30m+Ob4VCuVurRLImpQbwRwSbQ9jSAAIgawgkWGFucUu+GZVN+zdgpTQLeCu1jH6wAD41753Zlpc="}],"size":5277,"noattachment":false,"key":"/fuzzy/-/fuzzy-0.1.2.tgz"},"maintainers":[{"name":"mattyork","email":"york.matt@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/fuzzy-0.1.2.tgz_1474834435230_0.21343168942257762"},"directories":{},"readme":"# fuzzy [![Build Status](https://img.shields.io/travis/mattyork/fuzzy/master.svg)](https://travis-ci.org/mattyork/fuzzy) [![npm version](https://badge.fury.io/js/fuzzy.svg)](https://badge.fury.io/js/fuzzy)\n\n1k standalone fuzzy search / fuzzy filter a la Sublime Text's command-p fuzzy file search. Works in both node and browser.\n\n[![Example](http://i.imgur.com/obzCQq7.gif)](http://htmlpreview.github.io/?https://github.com/mattyork/fuzzy/blob/master/examples/disney.html)\n\nTry it yourself: [Disney Character Search Example](http://htmlpreview.github.io/?https://github.com/mattyork/fuzzy/blob/master/examples/disney.html)\n\n## Get it\n\nNode:\n\n```bash\n$ npm install --save fuzzy\n$ node\n> var fuzzy = require('fuzzy');\n> console.log(fuzzy)\n{ test: [Function],\n  match: [Function],\n  filter: [Function] }\n```\n\nBrowser:\n\n```html\n<script src=\"/path/to/fuzzy.js\"></script>\n<script>\n  console.log(fuzzy);\n  // Object >\n  //   filter: function (pattern, arr, opts) {\n  //   match: function (pattern, string, opts) {\n  //   test: function (pattern, string) {\n</script>\n```\n\n## Use it\n\nPadawan: Simply filter an array of strings.\n\n```javascript\nvar list = ['baconing', 'narwhal', 'a mighty bear canoe'];\nvar results = fuzzy.filter('bcn', list)\nvar matches = results.map(function(el) { return el.string; });\nconsole.log(matches);\n// [ 'baconing', 'a mighty bear canoe' ]\n```\n\nJedi: Wrap matching characters in each string\n\n```javascript\nvar list = ['baconing', 'narwhal', 'a mighty bear canoe'];\nvar options = { pre: '<', post: '>' };\nvar results = fuzzy.filter('bcn', list, options)\nconsole.log(results);\n// [\n//   {string: '<b>a<c>o<n>ing'           , index: 0, score: 3, original: 'baconing'},\n//   {string: 'a mighty <b>ear <c>a<n>oe', index: 2, score: 3, original: 'a mighty bear canoe'}\n// ]\n```\n\nJedi Master: sometimes the array you give is not an array of strings. You can\npass in a function that creates the string to match against from each element\nin the given array\n\n```javascript\nvar list = [\n    {rompalu: 'baconing', zibbity: 'simba'}\n  , {rompalu: 'narwhal' , zibbity: 'mufasa'}\n  , {rompalu: 'a mighty bear canoe', zibbity: 'saddam hussein'}\n];\nvar options = {\n    pre: '<'\n  , post: '>'\n  , extract: function(el) { return el.rompalu; }\n};\nvar results = fuzzy.filter('bcn', list, options);\nvar matches = results.map(function(el) { return el.string; });\nconsole.log(matches);\n// [ '<b>a<c>o<n>ing', 'a mighty <b>ear <c>a<n>oe' ]\n```\n\n## Examples\nCheck out the html files in the [examples](https://github.com/mattyork/fuzzy/tree/master/examples) directory.\n\nTry the examples live: \n- [disney](http://htmlpreview.github.io/?https://github.com/mattyork/fuzzy/blob/master/examples/disney.html)\n- [wikipedia](http://htmlpreview.github.io/?https://github.com/mattyork/fuzzy/blob/master/examples/wikipedia.html)\n## Documentation\n[Code is well documented](https://github.com/mattyork/fuzzy/blob/master/lib/fuzzy.js) and the [unit tests](https://github.com/mattyork/fuzzy/blob/master/test/fuzzy.test.js) cover all functionality\n\n## Contributing\nFork the repo!\n\n    git clone <your_fork>\n    cd fuzzy\n    npm install\n    make\n\nAdd unit tests for any new or changed functionality. Lint, test, and minify using make, then shoot me a pull request.\n\n## Release History\nv0.1.0 - July 25, 2012\n\n* Initial Release\n\nv0.1.1 - September 19, 2015\n\n* Fix broken links in package.json\n* Fix examples\n\nv0.1.2 - September 25, 2016\n\n* Exact matches get the highest score. #15\n* Add TypeScript typings #21\n* Better error handling for invalid input #13\n* Smaller bower install footprint #22\n\nv0.1.3 - October 1, 2016\n\n* Fix blocking bug in React Native #27\n\n## License\nCopyright (c) 2015 Matt York\nLicensed under the MIT license.\n\n## TODO\n\n1. Search improvement: behave a bit more like sublime text by getting\n   the BEST match in a given string, not just the first. For example,\n   searching for 'bass' in 'bodacious bass' should match against 'bass',\n   but it currently matches like so: `<b>od<a>ciou<s> ba<s>s`. There is\n   a test already written, just need to implement it. Naive O(n^2) worst\n   case: find every match in the string, then select the highest scoring\n   match. Should benchmark this against current implementation once implemented\n   Also, \"reactive rice\" would be `<r><e>active r<i><c>e`\n2. Search feature: Work on multiple strings in a match. For example, be able\n   to match against 'stth' against an object { folder: 'stuff', file: 'thing' }\n3. Async batch updates so the UI doesn't block for huge sets. Or maybe Web Workers?\n4. Performance performance performance!\n","publish_time":1474834437710,"_cnpm_publish_time":1474834437710,"dist-tags":{"latest":"0.1.3"}}