Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
refactor(indexUtils): use new omit where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Haroenv committed May 17, 2019
1 parent 21f7cb3 commit 2e8d630
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/react-instantsearch-core/src/core/indexUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { has, omit, get } from 'lodash';
import { has, omit as lodashOmit, get } from 'lodash';
import { omit } from './utils';

export function getIndexId(context) {
return hasMultipleIndices(context)
Expand Down Expand Up @@ -239,11 +240,11 @@ function cleanUpValueWithSingleIndex({
if (namespace) {
return {
...searchState,
[namespace]: omit(searchState[namespace], attribute),
[namespace]: omit(searchState[namespace], [attribute]),
};
}

return omit(searchState, id);
return omit(searchState, [id]);
}

function cleanUpValueWithMultiIndex({
Expand All @@ -262,11 +263,11 @@ function cleanUpValueWithMultiIndex({
...searchState.indices,
[indexId]: {
...indexSearchState,
[namespace]: omit(indexSearchState[namespace], attribute),
[namespace]: omit(indexSearchState[namespace], [attribute]),
},
},
};
}

return omit(searchState, `indices.${indexId}.${id}`);
return lodashOmit(searchState, `indices.${indexId}.${id}`);
}

0 comments on commit 2e8d630

Please sign in to comment.