Skip to content

Instantly share code, notes, and snippets.

@sebmarkbage
Created November 27, 2011 16:37
Show Gist options
  • Save sebmarkbage/1397777 to your computer and use it in GitHub Desktop.
Save sebmarkbage/1397777 to your computer and use it in GitHub Desktop.
Module Syntax With Global Imports (Designed to Emulate ECMAScript 6 Modules)
var two = 2, four = 4, five = 5;
exports: function sum(x, y) {
return x + y;
}
exports: var pi = 3.141593, birthday = 12;
exports: two, four;
imports: "Math.js";
console.log(sum(two, four)); // 6
console.log(five); // undefined
console.log(birthday); // 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment