Created
December 4, 2017 07:28
-
-
Save shuuuuun/56b06cfe438ec780cae04d978c296405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const toObj = (array) => { | |
// ex. ['str'] -> { str: 'str' } | |
const obj = {}; | |
array.forEach(v => obj[v] = v); | |
return obj; | |
}; | |
export default toObj([ | |
// SAMPLE | |
'SAMPLE_MUTATION_INCREMENT', | |
'SAMPLE_MUTATION_DECREMENT', | |
'SAMPLE_ACTION_INCREMENT', | |
'SAMPLE_ACTION_DECREMENT', | |
'SAMPLE_ACTION_INCREMENT_IF_ODD', | |
'SAMPLE_ACTION_INCREMENT_ASYNC', | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment