From 1a2ae4bd2c200b233f6f4b646dd5aecdb80e9add Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 23 Sep 2013 12:03:33 -0700 Subject: [PATCH] pluck and findWhere, not map and find --- UI/Navbar/Search.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/UI/Navbar/Search.js b/UI/Navbar/Search.js index 35e0d733b..3391f9320 100644 --- a/UI/Navbar/Search.js +++ b/UI/Navbar/Search.js @@ -7,9 +7,7 @@ define( $.fn.bindSearch = function () { $(this).typeahead({ source : function () { - return SeriesCollection.map(function (model) { - return model.get('title'); - }); + return SeriesCollection.pluck('title'); }, sorter: function (items) { @@ -17,9 +15,7 @@ define( }, updater: function (item) { - var series = SeriesCollection.find(function (model) { - return model.get('title') === item; - }); + var series = SeriesCollection.findWhere({ title: item }); this.$element.blur(); App.Router.navigate('/series/{0}'.format(series.get('titleSlug')), { trigger: true });