Skip to content

Instantly share code, notes, and snippets.

@sergueyarellano
Created May 28, 2021 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergueyarellano/cd62dae14d5fb85f75b61a75f0e46330 to your computer and use it in GitHub Desktop.
Save sergueyarellano/cd62dae14d5fb85f75b61a75f0e46330 to your computer and use it in GitHub Desktop.
function setWith (path, modifier) {
return payload => {
const newPayload = cloneDeep(payload)
const data = get(newPayload, path)
return set(newPayload, path, modifier(data))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment