Skip to content

Instantly share code, notes, and snippets.

@pyalot
Created July 4, 2013 20:10
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 pyalot/5929967 to your computer and use it in GitHub Desktop.
Save pyalot/5929967 to your computer and use it in GitHub Desktop.
Masking javascript globals
maskEval = (src) ->
whitelist = ['Math', 'performance']
names = []
for name of window
if name not in whitelist
names.push name
names = names.join(',')
return eval("(function(){var #{names};return #{src};})").call({})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment