Commit 5ab2b0a7 authored by Winnie Hellmann's avatar Winnie Hellmann Committed by Clement Ho

Replace _.findWhere() with _.find()

parent 777d1880
......@@ -52,7 +52,7 @@ export default {
this.$emit('projectClicked', project);
},
isSelected(project) {
return Boolean(_.findWhere(this.selectedProjects, { id: project.id }));
return Boolean(_.find(this.selectedProjects, { id: project.id }));
},
onInput: _.debounce(function debouncedOnInput() {
this.$emit('searched', this.searchQuery);
......
......@@ -445,7 +445,7 @@ export default class AccessDropdown {
break;
}
const isActive = _.findWhere(this.getSelectedItems(), criteria) ? 'is-active' : '';
const isActive = _.find(this.getSelectedItems(), criteria) ? 'is-active' : '';
switch (item.type) {
case LEVEL_TYPES.USER:
......
......@@ -95,7 +95,7 @@ export default class ProtectedBranchEdit {
// Do this only for users for now
// get the current data for selected items
const selectedItems = this[dropdownName].getSelectedItems();
const currentSelectedItem = _.findWhere(selectedItems, {
const currentSelectedItem = _.find(selectedItems, {
user_id: currentItem.user_id,
});
......
......@@ -80,7 +80,7 @@ export default class ProtectedEnvironmentEdit {
// Do this only for users for now
// get the current data for selected items
const selectedItems = this[dropdownName].getSelectedItems();
const currentSelectedItem = _.findWhere(selectedItems, {
const currentSelectedItem = _.find(selectedItems, {
user_id: currentItem.user_id,
});
......
......@@ -78,7 +78,7 @@ export default class ProtectedTagEdit {
// Do this only for users for now
// get the current data for selected items
const selectedItems = this[dropdownName].getSelectedItems();
const currentSelectedItem = _.findWhere(selectedItems, {
const currentSelectedItem = _.find(selectedItems, {
user_id: currentItem.user_id,
});
......
......@@ -33,7 +33,7 @@ export const addProjectsToDashboard = ({ state, dispatch }) =>
.catch(() => dispatch('receiveAddProjectsToDashboardError'));
export const toggleSelectedProject = ({ commit, state }, project) => {
if (!_.findWhere(state.selectedProjects, { id: project.id })) {
if (!_.find(state.selectedProjects, { id: project.id })) {
commit(types.ADD_SELECTED_PROJECT, project);
} else {
commit(types.REMOVE_SELECTED_PROJECT, project);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment