diff --git a/packages/react-instantsearch/src/components/RatingMenu.js b/packages/react-instantsearch/src/components/RatingMenu.js index d2d4be7e39..4797a82c28 100644 --- a/packages/react-instantsearch/src/components/RatingMenu.js +++ b/packages/react-instantsearch/src/components/RatingMenu.js @@ -1,3 +1,4 @@ +import { find, fill } from 'lodash'; import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; @@ -144,10 +145,9 @@ class RatingMenu extends Component { .map(item => ({ ...item, value: parseFloat(item.value) })) .filter(item => item.value >= limitMin && item.value <= limitMax); - const range = new Array(safeInclusiveLength) - .fill(null) + const range = fill(new Array(safeInclusiveLength), null) .map((_, index) => { - const element = values.find(item => item.value === limitMax - index); + const element = find(values, item => item.value === limitMax - index); const placeholder = { value: limitMax - index, count: 0, total: 0 }; return element || placeholder; diff --git a/packages/react-instantsearch/src/core/createConnector.js b/packages/react-instantsearch/src/core/createConnector.js index edc0cd82d3..b87c4080c2 100644 --- a/packages/react-instantsearch/src/core/createConnector.js +++ b/packages/react-instantsearch/src/core/createConnector.js @@ -1,6 +1,6 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; -import { has, isEqual } from 'lodash'; +import { has, isEqual, find } from 'lodash'; import { shallowEqual, getDisplayName, removeEmptyKey } from './utils'; /** @@ -82,7 +82,8 @@ export default function createConnector(connectorDesc) { this.unregisterWidget = widgetsManager.registerWidget(this); } if (process.env.NODE_ENV === 'development') { - const onlyGetProvidedPropsUsage = !Object.keys(connectorDesc).find( + const onlyGetProvidedPropsUsage = !find( + Object.keys(connectorDesc), key => [ 'getMetadata', diff --git a/packages/react-instantsearch/src/core/createInstantSearchManager.js b/packages/react-instantsearch/src/core/createInstantSearchManager.js index b6f997b031..4e403c988a 100644 --- a/packages/react-instantsearch/src/core/createInstantSearchManager.js +++ b/packages/react-instantsearch/src/core/createInstantSearchManager.js @@ -1,4 +1,4 @@ -import { omit, isEmpty } from 'lodash'; +import { omit, isEmpty, find } from 'lodash'; import algoliasearchHelper, { SearchParameters } from 'algoliasearch-helper'; import createWidgetsManager from './createWidgetsManager'; import createStore from './createStore'; @@ -101,7 +101,7 @@ export default function createInstantSearchManager({ const targetedIndex = widget.context.multiIndexContext ? widget.context.multiIndexContext.targetedIndex : widget.props.indexName; - const index = indices.find(i => i.targetedIndex === targetedIndex); + const index = find(indices, i => i.targetedIndex === targetedIndex); if (index) { index.widgets.push(widget); } else {