Skip to content

Instantly share code, notes, and snippets.

@angelomiranda
Last active August 5, 2017 04:34
Show Gist options
  • Save angelomiranda/f2906d04b37afde252b27ac1711af21d to your computer and use it in GitHub Desktop.
Save angelomiranda/f2906d04b37afde252b27ac1711af21d to your computer and use it in GitHub Desktop.
const formValue = form.value; // model values coming from ngForm model
const arrayOfObjects = Object.keys(formValue)
.reduce((result, current) => {
const value = formValue[current];
if (_.includes(this.remoteLoggingOptions, current) && value) {
result.push({
key: 'loggerRemoteLevels',
value: current
});
}
if (current === 'waitTime') {
result.push({
key: 'loggerRemoteWaitTime',
value: value
});
}
if (current === 'maxMsgs') {
result.push({
key: 'loggerRemoteMaxMsgs',
value: value
});
}
return result;
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment