Skip to content

Commit

Permalink
style(type): using reduce for enum values
Browse files Browse the repository at this point in the history
  • Loading branch information
nodkz committed Mar 24, 2016
1 parent 564cb7c commit 44356a3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/type/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@ function stringToGraphQLType(type) {
* @return {Object}
*/
function listToGraphQLEnumType(list, name) {
const values = {};
list.forEach((val) => { values[val] = {value: val}; });
const values = reduce(list, (values, val) => {
values[val] = {value: val};
return values;
}, {});
return new GraphQLEnumType({ name, values });
}

Expand Down

0 comments on commit 44356a3

Please sign in to comment.