       else
         udefine.modules[platform][name] = value
       @
-      
+
     clear: ->
       udefine.modules[p] = {} for p in platforms
       @
-  
+
   # Default settings for udefine environment
   udefine.env or=
     amd: do -> !!(define? and (define.amd or define.umd))
     commonjs: hasModule
     browser: not hasModule
     globals: not hasModule and not udefine.amd
-  
+
   # Paths
   udefine.paths =
     commonjs:
       base: undefined
-  
+
   # Require modules
   udefine.require = (name, callback) ->
     name = [name] unless Array.isArray name
-    
+
     reqDeps = (udefine.modules.get n for n in name)
     callback.apply @, reqDeps
-  
+
   # Default configuration definition
   udefine.defaultConfig = ->
     udefine.modules.commonjs.root = root
     udefine.modules.globals.root = root
-  
+
     define('root', -> root) if root.define?
-  
+
   # Call default configuration
   udefine.defaultConfig()
-  
+
   # Configuration helper function
   udefine.configure = (configFunc) ->
     context = {}
     for own e of udefine.env
       context[e] = (platformDef) =>
         if udefine.env[e] then platformDef.call @
-  
+
     configFunc.apply context, [root, udefine]
-  
+
   # Export udefine function on CommonJS environments
   if hasModule then module.exports = udefine else root.udefine = udefine

        else
          udefine.modules[platform][name] = undefined
      @
      
    remove: (name) ->
      for p in platforms
        if Object.hasOwnProperty.call udefine.modules[p], name
          delete udefine.modules[p][name]
      @
    
    get: (name) -> udefine.modules[platform][name]
    set: (name, value) ->
      if typeof value is 'object'

      require path.join(process.cwd(), prePath, udefine.modules[type][name])
    else
      udefine.modules[type][name]

  # Main entry point
  udefine = (name, deps, factory) ->
    throw new Error 'A udefine module needs to have a name' unless name?

    unless name is name.toLowerCase()
      console.warn 'A module should be all lowercase'

    if typeof deps is 'function' or isObject(deps)
      [name, deps, factory] = [name, [], deps]

    # Define, either AMD or UMD (if any?)
    if define?
      result = define.apply @, arguments if define.amd or define.umd
    else
      depArr = (loadModule(dep, platform) for dep in deps)

      result = resolveModule factory, depArr

      # Set dependency if it does not exist
      unless Object.hasOwnProperty.call udefine.modules[platform], name
        udefine.modules[platform][name] = result

    # Automatically inject if property is set
    unless Object.hasOwnProperty.call udefine.inject.modules, name
      if udefine.autoInject
        udefine.inject.add name, {root, name} if udefine.env.globals

        # Auto injection does not work on CommonJS
        # TODO: Need to investigate if it's even possible
        ###
