From 7b3ea2059c8f5b74ff62f401144a07c2d8aa7199 Mon Sep 17 00:00:00 2001 From: Alex Kanunnikov Date: Wed, 23 Aug 2017 18:54:02 +0300 Subject: [PATCH] remoded code duplicates --- app/components/api-index-filter.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/app/components/api-index-filter.js b/app/components/api-index-filter.js index 6b11d0d73..82a6f746c 100644 --- a/app/components/api-index-filter.js +++ b/app/components/api-index-filter.js @@ -3,33 +3,22 @@ import Component from '@ember/component'; import uniq from 'npm:lodash.uniq'; import sortBy from 'npm:lodash.sortby'; +const filterDataComputedParams = 'filterData.{showInherited,showProtected,showPrivate,showDeprecated}'; export default Component.extend({ classNames: ['api-index-filter'], - filteredMethods: computed('model.methods.[]', - 'filterData.showInherited', - 'filterData.showProtected', - 'filterData.showPrivate', - 'filterData.showDeprecated', + filteredMethods: computed('model.methods.[]', filterDataComputedParams, function() { return this.filterItems('methods'); }), - filteredEvents: computed('model.events.[]', - 'filterData.showInherited', - 'filterData.showProtected', - 'filterData.showPrivate', - 'filterData.showDeprecated', + filteredEvents: computed('model.events.[]', filterDataComputedParams, function() { return this.filterItems('events'); }), - filteredProperties: computed('model.properties.[]', - 'filterData.showInherited', - 'filterData.showProtected', - 'filterData.showPrivate', - 'filterData.showDeprecated', + filteredProperties: computed('model.properties.[]', filterDataComputedParams, function() { return this.filterItems('properties'); }),