Skip to content

Instantly share code, notes, and snippets.

@jfet97
Created December 30, 2020 17:04
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 jfet97/6790e0e96284b4951ab34167304968e8 to your computer and use it in GitHub Desktop.
Save jfet97/6790e0e96284b4951ab34167304968e8 to your computer and use it in GitHub Desktop.
const scope = callback => ({
with: Function(`with(arguments[0])return(${callback})()`)
});
scope(() => ['a', test, 'c']).with({test: 'b'});
// ["a", "b", "c"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment