Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/busterc/fuzzysort-collection
:mag: Fast SublimeText-like fuzzy search for collections
https://github.com/busterc/fuzzysort-collection
collections filter fuzzy fuzzy-search sorting-algorithms
Last synced: 10 days ago
JSON representation
:mag: Fast SublimeText-like fuzzy search for collections
- Host: GitHub
- URL: https://github.com/busterc/fuzzysort-collection
- Owner: busterc
- License: isc
- Created: 2017-08-21T20:30:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-25T21:55:08.000Z (over 6 years ago)
- Last Synced: 2024-11-29T00:17:11.801Z (24 days ago)
- Topics: collections, filter, fuzzy, fuzzy-search, sorting-algorithms
- Language: JavaScript
- Size: 48.8 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fuzzysort-collection [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]
> Fast SublimeText-like fuzzy search for collectionsThanks to [@farzher](https://github.com/farzher) for [fuzzysort](https://github.com/farzher/fuzzysort)
## Installation
```sh
$ npm install --save fuzzysort-collection
```## Usage
```js
const fuzz = require('fuzzysort-collection');// You can config fuzzysort options:
// https://github.com/farzher/fuzzysort#options
fuzz.fuzzysort.highlightOpen = '';
fuzz.fuzzysort.highlightClose = '';const crop = [{
a: {
b: 'Snap'
}
}, {
a: {
b: 'Paypal'
}
}, {
a: {
b: 'Google'
}
}, {
a: {
b: 'Apple'
}
}];let cream = fuzz('ap', crop, 'a.b');
/*
[
{
"meta": {
"matches": [
0,
1
],
"target": "Apple",
"lower": "apple",
"score": 3,
"theMatches": [
0,
1
],
"highlighted": "Apple"
},
"data": {
"a": {
"b": "Apple"
}
}
},
{
"meta": {
"matches": [
2,
3
],
"target": "Snap",
"lower": "snap",
"score": 2002,
"theMatches": [
2,
3
],
"highlighted": "Snap"
},
"data": {
"a": {
"b": "Snap"
}
}
},
{
"meta": {
"matches": [
1,
3
],
"target": "Paypal",
"lower": "paypal",
"score": 4004,
"theMatches": [
1,
3
],
"highlighted": "Paypal"
},
"data": {
"a": {
"b": "Paypal"
}
}
}
]
*/
```
## LicenseISC © [Buster Collings](https://about.me/buster)
[npm-image]: https://badge.fury.io/js/fuzzysort-collection.svg
[npm-url]: https://npmjs.org/package/fuzzysort-collection
[travis-image]: https://travis-ci.org/busterc/fuzzysort-collection.svg?branch=master
[travis-url]: https://travis-ci.org/busterc/fuzzysort-collection
[daviddm-image]: https://david-dm.org/busterc/fuzzysort-collection.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/busterc/fuzzysort-collection
[coveralls-image]: https://coveralls.io/repos/busterc/fuzzysort-collection/badge.svg
[coveralls-url]: https://coveralls.io/r/busterc/fuzzysort-collection