mirror of
https://github.com/Choices-js/Choices.git
synced 2024-06-10 18:02:47 +02:00
Minor tweaks
This commit is contained in:
parent
5640744bf3
commit
3886cbbd5c
|
@ -862,10 +862,9 @@ class Choices {
|
||||||
// Add each result as a choice
|
// Add each result as a choice
|
||||||
parsedResults.forEach(result => {
|
parsedResults.forEach(result => {
|
||||||
if (result.choices) {
|
if (result.choices) {
|
||||||
const groupId = result.id || null;
|
|
||||||
this._addGroup({
|
this._addGroup({
|
||||||
group: result,
|
group: result,
|
||||||
id: groupId,
|
id: result.id || null,
|
||||||
valueKey: value,
|
valueKey: value,
|
||||||
labelKey: label,
|
labelKey: label,
|
||||||
});
|
});
|
||||||
|
@ -904,9 +903,7 @@ class Choices {
|
||||||
// If new value matches the desired length and is not the same as the current value with a space
|
// If new value matches the desired length and is not the same as the current value with a space
|
||||||
const haystack = this._store.searchableChoices;
|
const haystack = this._store.searchableChoices;
|
||||||
const needle = newValue;
|
const needle = newValue;
|
||||||
const keys = isType('Array', this.config.searchFields)
|
const keys = [...this.config.searchFields];
|
||||||
? this.config.searchFields
|
|
||||||
: [this.config.searchFields];
|
|
||||||
const options = Object.assign(this.config.fuseOptions, { keys });
|
const options = Object.assign(this.config.fuseOptions, { keys });
|
||||||
const fuse = new Fuse(haystack, options);
|
const fuse = new Fuse(haystack, options);
|
||||||
const results = fuse.search(needle);
|
const results = fuse.search(needle);
|
||||||
|
|
Loading…
Reference in a new issue