Last active
October 10, 2017 13:32
-
-
Save TheBox193/bd79d55a3dc1b56aa72b6e29ec2686c8 to your computer and use it in GitHub Desktop.
Immutable get helper
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
const get = function(state, arrayPath, defaultValue) { | |
if (arrayPath.length === 1) { | |
return state.get(arrayPath[0], defaultValue); | |
} else { | |
return state.getIn(arrayPath, defaultValue); | |
} | |
} |
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
const get = function(state, arrayPath, defaultValue) { | |
return state.getIn(arrayPath, defaultValue); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment