Skip to content

Commit

Permalink
Replaced lodash.merge with merge-options (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
underoot authored Jan 16, 2024
1 parent 15d305d commit bd29cf7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
31 changes: 17 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@
},
"dependencies": {
"@mapbox/polyline": "^1.1.1",
"deep-assign": "^3.0.0",
"lodash.debounce": "^4.0.6",
"lodash.isequal": "^4.2.0",
"lodash.merge": "^4.6.2",
"lodash.template": "^4.2.5",
"merge-options": "^3.0.4",
"redux": "^4.2.0",
"redux-thunk": "^2.4.2",
"suggestions": "^1.7.1",
Expand Down
8 changes: 4 additions & 4 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as types from '../constants/action_types.js';
import merge from 'lodash.merge';
import merge from 'merge-options';

const initialState = {
const getInitialState = () => ({
// Options set on initialization
api: 'https://api.mapbox.com/directions/v5/',
profile: 'mapbox/driving-traffic',
Expand Down Expand Up @@ -49,9 +49,9 @@ const initialState = {
fetchDirectionsRequest: null,
routeIndex: 0,
routePadding: 80
};
});

function data(state = initialState, action) {
function data(state = getInitialState(), action) {
switch (action.type) {
case types.SET_OPTIONS: {
return merge({}, state, action.options);
Expand Down

0 comments on commit bd29cf7

Please sign in to comment.