From 3886cbbd5c1739d9cb519d2527ac8e553aa19a3d Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Tue, 29 May 2018 20:30:58 +0100 Subject: [PATCH] Minor tweaks --- src/scripts/choices.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/scripts/choices.js b/src/scripts/choices.js index d0e76a1..84d45bb 100644 --- a/src/scripts/choices.js +++ b/src/scripts/choices.js @@ -862,10 +862,9 @@ class Choices { // Add each result as a choice parsedResults.forEach(result => { if (result.choices) { - const groupId = result.id || null; this._addGroup({ group: result, - id: groupId, + id: result.id || null, valueKey: value, 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 const haystack = this._store.searchableChoices; const needle = newValue; - const keys = isType('Array', this.config.searchFields) - ? this.config.searchFields - : [this.config.searchFields]; + const keys = [...this.config.searchFields]; const options = Object.assign(this.config.fuseOptions, { keys }); const fuse = new Fuse(haystack, options); const results = fuse.search(needle);