Skip to content

Instantly share code, notes, and snippets.

@TheBox193
Last active October 10, 2017 13:32
Show Gist options
  • Save TheBox193/bd79d55a3dc1b56aa72b6e29ec2686c8 to your computer and use it in GitHub Desktop.
Save TheBox193/bd79d55a3dc1b56aa72b6e29ec2686c8 to your computer and use it in GitHub Desktop.
Immutable get helper
const get = function(state, arrayPath, defaultValue) {
if (arrayPath.length === 1) {
return state.get(arrayPath[0], defaultValue);
} else {
return state.getIn(arrayPath, defaultValue);
}
}
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