Skip to content

Instantly share code, notes, and snippets.

@can3p
Created November 9, 2012 15:12
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 can3p/4046235 to your computer and use it in GitHub Desktop.
Save can3p/4046235 to your computer and use it in GitHub Desktop.
commonjs + amd wrapper
do (exports = if typeof exports == 'undefined' then undefined else exports) ->
module = ->
#example module content
_ = require 'underscore'
_([3,1,2]).sort()
return {
a: ->
b: ->
}
if exports
contents = module()
exports[name] = value for name, value of contents
else unless typeof define == 'undefined'
define module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment