Skip to content

Instantly share code, notes, and snippets.

@mgtitimoli
Last active January 29, 2016 05:59
Show Gist options
  • Save mgtitimoli/61fed3b9db4b00f9f1d6 to your computer and use it in GitHub Desktop.
Save mgtitimoli/61fed3b9db4b00f9f1d6 to your computer and use it in GitHub Desktop.
common-js compatible module definition
(function(module, exports){
module.exports = {
a: 1,
b: 2
};
}).apply(
undefined,
(
(typeof module === "object" && module !== null)
&& (typeof module.exports === "object" && module.exports !== null)
)
? [ module, module.exports ]
: (function(object, propName) {
return [
{
get exports() { return object[propName]; },
set exports(value) { object[propName] = value; }
},
object[propName] = {}
]
})(window, "app")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment