Skip to content

Commit

Permalink
Writing in ES6 is lovely
Browse files Browse the repository at this point in the history
  • Loading branch information
tristen committed Aug 22, 2015
1 parent 26d636b commit a6a76fb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"stage": 0,
"loose": "all",
"plugins": ["object-assign"]
}
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"comma-spacing": [0],
"key-spacing": [0],
"no-use-before-define": [0],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"react/no-multi-comp": 2,
"react/prop-types": 2
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"babel-core": "^5.8.22",
"babel-eslint": "^4.0.10",
"babel-loader": "^5.3.2",
"babel-plugin-object-assign": "^1.2.1",
"babelify": "^6.1.3",
"browserify": "^11.0.1",
"eslint": "^1.1.0",
Expand Down
1 change: 0 additions & 1 deletion src/components/shared/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default class Input extends Component {

render() {
const { options } = this.props;

const inputAttributes = {
placeholder: options.placeholder,
onChange: this.onChange.bind(this)
Expand Down
32 changes: 12 additions & 20 deletions src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,36 @@ const initialState = {
function inputs(state = initialState, action) {
switch (action.type) {
case types.ORIGIN_INPUT:
return {
return Object.assign({}, state, {
originQuery: action.query,
originResults: action.results,
destinationResults: state.destinationResults,
destinationQuery: state.destinationQuery
};
originResults: action.results
});

case types.DESTINATION_INPUT:
return {
originQuery: state.originQuery,
originResults: state.originResults,
return Object.assign({}, state, {
destinationQuery: action.query,
destinationResults: action.results
};
});

case types.ORIGIN_CLEAR:
return {
return Object.assign({}, state, {
originQuery: '',
originResults: [],
destinationResults: state.destinationResults,
destinationQuery: state.destinationQuery
};
originResults: []
});

case types.DESTINATION_CLEAR:
return {
originQuery: state.originQuery,
originResults: state.originResults,
return Object.assign({}, state, {
destinationQuery: '',
destinationResults: []
};
});

case types.REVERSE_INPUTS:
return {
return Object.assign({}, state, {
originResults: state.destinationResults,
originQuery: state.destinationQuery,
destinationResults: state.originResults,
destinationQuery: state.originQuery
};
});

default:
return state;
Expand Down

0 comments on commit a6a76fb

Please sign in to comment.