Last active
December 5, 2017 16:20
-
-
Save nxnzesrc/eba60b1dbd4678b8a0fb27d15c4c46e6 to your computer and use it in GitHub Desktop.
Commenting on comments (what comments)
This file contains hidden or 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
| import { isString, isObject } from 'lodash'; | |
| function updateAnswer(updateCommand, typeKeys) { | |
| // If either of `updateCommand` or `typeKeys` | |
| // is null or defined, then we can stop here and just return | |
| if (!updateCommand || !typeKeys) { | |
| return; | |
| } | |
| // If `typeKeys` is a string | |
| if (isString(typeKeys)) { | |
| return { | |
| type: typeKeys, | |
| updateCommand | |
| }; | |
| } | |
| // If `typeKeys` is an object | |
| if (isObject(typeKeys)) { | |
| return (dispatch, getState) => { | |
| dispatch({ type: typeKeys.update, updateCommand }); | |
| }; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment