diff options
author | Maximilian Hils <git@maximilianhils.com> | 2016-06-02 09:51:39 -0700 |
---|---|---|
committer | Maximilian Hils <git@maximilianhils.com> | 2016-06-02 09:51:39 -0700 |
commit | 7a388560d7d3ef22be0bdef1811414ad18ff2484 (patch) | |
tree | d81a64c8096328e0df0937261ef4fe8097707c41 | |
parent | 9e3591e3c225c51d5a5b80eb331719d20d14dc48 (diff) | |
download | mitmproxy-7a388560d7d3ef22be0bdef1811414ad18ff2484.tar.gz mitmproxy-7a388560d7d3ef22be0bdef1811414ad18ff2484.tar.bz2 mitmproxy-7a388560d7d3ef22be0bdef1811414ad18ff2484.zip |
use object spread operator
While the spread operator is not part of ES6, React also uses it for JSX.
It makes sense for us to keep it in other parts of the codebase as well.
-rw-r--r-- | mitmproxy/web/static/app.js | 4 | ||||
-rw-r--r-- | web/.babelrc | 2 | ||||
-rw-r--r-- | web/src/js/reducers/eventLog.js | 5 |
3 files changed, 7 insertions, 4 deletions
diff --git a/mitmproxy/web/static/app.js b/mitmproxy/web/static/app.js index 88881601..e517f33e 100644 --- a/mitmproxy/web/static/app.js +++ b/mitmproxy/web/static/app.js @@ -6495,6 +6495,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + var _redux = require("redux"); var _reduxActions = require("../reduxActions"); @@ -6513,7 +6515,7 @@ var visibilityFilter = function visibilityFilter() { switch (action.type) { case _reduxActions.TOGGLE_EVENTLOG_FILTER: - return Object.assign({}, state, _defineProperty({}, action.filter, !state[action.filter])); + return _extends({}, state, _defineProperty({}, action.filter, !state[action.filter])); default: return state; } diff --git a/web/.babelrc b/web/.babelrc index 5dd7708c..e2d67e33 100644 --- a/web/.babelrc +++ b/web/.babelrc @@ -1,4 +1,4 @@ { "presets": ["es2015", "react"], - "plugins": ["transform-class-properties"] + "plugins": ["transform-class-properties", "transform-object-rest-spread"] }
\ No newline at end of file diff --git a/web/src/js/reducers/eventLog.js b/web/src/js/reducers/eventLog.js index 169cd306..9d078c14 100644 --- a/web/src/js/reducers/eventLog.js +++ b/web/src/js/reducers/eventLog.js @@ -10,9 +10,10 @@ const defaultVisibility = { const visibilityFilter = (state = defaultVisibility, action) => { switch (action.type) { case TOGGLE_EVENTLOG_FILTER: - return Object.assign({}, state, { + return { + ...state, [action.filter]: !state[action.filter] - }); + }; default: return state; } |