Skip to content

Instantly share code, notes, and snippets.

@rsolci
Created August 16, 2018 10:56
Show Gist options
  • Save rsolci/47ec5a1d7609561eb07973506f11f331 to your computer and use it in GitHub Desktop.
Save rsolci/47ec5a1d7609561eb07973506f11f331 to your computer and use it in GitHub Desktop.
Replace all properties from targetO with values from sourceO, returning a new object.
Object.keys(targetO).reduce((memo, key)=>({ ...memo, [key]: key in sourceO ? sourceO[key] : targetO[key] }), {})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment