Skip to content

Instantly share code, notes, and snippets.

@moui72
Created December 29, 2017 20:57
Show Gist options
  • Save moui72/5ca2774faf604ef7d66192363c3b5d55 to your computer and use it in GitHub Desktop.
Save moui72/5ca2774faf604ef7d66192363c3b5d55 to your computer and use it in GitHub Desktop.
let state = {
...,
toggleables: [
// propertyName: default value
{ visible: true },
{ rankable: true }
],
...
}
let obj = {};
// is there a better way to do this?
state.toggleables.forEach(p => {
_.forOwn(p, (val, key) => {
obj[key] = val;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment