Skip to content

Instantly share code, notes, and snippets.

@carbide-public
Created March 11, 2019 20:28
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 carbide-public/2bc7d42bfaf25ca8aa4a71c166b1281a to your computer and use it in GitHub Desktop.
Save carbide-public/2bc7d42bfaf25ca8aa4a71c166b1281a to your computer and use it in GitHub Desktop.
untitled
const test = (a, b) => {
console.log(b)
return a
}
const cloneFunction = (action, user) => {
const clonedAction = action.bind({ })
clonedAction.user = user;
return clonedAction;
}
const cloned = cloneFunction(test, { token : 123 })
cloned.user
test.user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment