From 7256626d6023869fac7ffdcfe3d291b76fb19e64 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Fri, 4 Aug 2017 08:07:05 +0000 Subject: Remove monkey-patched Array.prototype.first() and last() methods --- app/assets/javascripts/filtered_search/dropdown_utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'app/assets/javascripts/filtered_search/dropdown_utils.js') diff --git a/app/assets/javascripts/filtered_search/dropdown_utils.js b/app/assets/javascripts/filtered_search/dropdown_utils.js index db5560fa753..8d711e3213c 100644 --- a/app/assets/javascripts/filtered_search/dropdown_utils.js +++ b/app/assets/javascripts/filtered_search/dropdown_utils.js @@ -123,11 +123,11 @@ class DropdownUtils { if (!allowMultiple && itemInExistingTokens) { updatedItem.droplab_hidden = true; - } else if (!lastKey || searchInput.split('').last() === ' ') { + } else if (!lastKey || _.last(searchInput.split('')) === ' ') { updatedItem.droplab_hidden = false; } else if (lastKey) { const split = lastKey.split(':'); - const tokenName = split[0].split(' ').last(); + const tokenName = _.last(split[0].split(' ')); const match = updatedItem.hint.indexOf(tokenName.toLowerCase()) === -1; updatedItem.droplab_hidden = tokenName ? match : false; -- cgit v1.2.1