react-tag-autocomplete
Advanced tools
Comparing version 5.10.0 to 5.11.0
# Changelog | ||
## 5.11.0 | ||
- Added the current query as the second argument for the `suggestionsFilter` option | ||
## 5.10.0 | ||
@@ -4,0 +8,0 @@ |
@@ -23,3 +23,3 @@ 'use strict' | ||
return suggestions.filter(suggestionsFilter).slice(0, length) | ||
return suggestions.filter(function (item) { return suggestionsFilter(item, query); }).slice(0, length) | ||
} | ||
@@ -26,0 +26,0 @@ |
@@ -23,3 +23,3 @@ 'use strict' | ||
return suggestions.filter(suggestionsFilter).slice(0, length) | ||
return suggestions.filter((item) => suggestionsFilter(item, query)).slice(0, length) | ||
} | ||
@@ -26,0 +26,0 @@ |
@@ -23,3 +23,3 @@ 'use strict' | ||
return suggestions.filter(suggestionsFilter).slice(0, length) | ||
return suggestions.filter((item) => suggestionsFilter(item, query)).slice(0, length) | ||
} | ||
@@ -26,0 +26,0 @@ |
{ | ||
"name": "react-tag-autocomplete", | ||
"version": "5.10.0", | ||
"version": "5.11.0", | ||
"description": "React Tag Autocomplete is a simple tagging component ready to drop in your React projects.", | ||
@@ -5,0 +5,0 @@ "main": "dist-es5/ReactTags.js", |
@@ -7,2 +7,4 @@ # React Tag Autocomplete | ||
**Version 6 of this component is in beta! Please [take a look here](https://github.com/i-like-robots/react-tags/tree/6.0)** ✨ | ||
![Screenshot of React Tag Autocomplete](https://cloud.githubusercontent.com/assets/271645/25478773/54aa2bbe-2b3a-11e7-95cf-d419f3c24418.png) | ||
@@ -121,6 +123,17 @@ | ||
A function to filter suggestion items on; takes a suggestion `item` as the single argument. | ||
A callback function to filter suggestion items with. The callback receives two arguments; a `suggestion` and the current `query` and must return a boolean value. | ||
If no function is supplied the default filter is applied. Default: `null`. | ||
Example of a function which returns items containing `query`: | ||
```js | ||
import stringScore from 'string-score' | ||
function suggestionsFilter(item, query) { | ||
const score = stringScore(item.name, query) | ||
return score > 0.5 | ||
} | ||
``` | ||
#### placeholder (optional) | ||
@@ -127,0 +140,0 @@ |
Sorry, the diff of this file is not supported yet
53648
308