Skip to content

Instantly share code, notes, and snippets.

@spion
Last active December 22, 2015 06:29
Show Gist options
  • Save spion/6431822 to your computer and use it in GitHub Desktop.
Save spion/6431822 to your computer and use it in GitHub Desktop.
ugly export from scope
// must copy it in every module. eww.
function exportscope(items) {
items.forEach(function(el) {
exports[el] = eval(el);
});
}
var a = 1, b = 2, c = 3;
// super-ugly
exportscope(['a', 'b', 'c']);
// Testing:
// run node repl
// console.log(require('./ugly-scope-export'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment