shim/define.js
function set(key, module, global) {
		var m = null;
		var isGlobal = global && typeof global !== 'undefined';

		// check to make sure the module has been assigned only once
		if (isGlobal) {
			if (global.hasOwnProperty(key)) {
				throw '[define-shim] Module ' + key + ' already exists';
			}
		}
		else if (_map.hasOwnProperty(key)) {
			throw '[define-shim] Module ' + key + ' already exists';
			return;
		}

		// construct the module if needed
		if (typeof module === 'function') m = module(get);
		else m = module;

		// assign the module to whichever object is preferred
		if (isGlobal) global[key] = m;
		else _map[key] = m;
	}
function set(key, module, global) {
		var m = null;
		var isGlobal = global && typeof global !== 'undefined';

		// check to make sure the module has been assigned only once
		if (isGlobal) {
			if (global.hasOwnProperty(key)) {
				throw '[define-shim] Module ' + key + ' already exists';
			}
		}
		else if (_map.hasOwnProperty(key)) {
			throw '[define-shim] Module ' + key + ' already exists';
			return;
		}

		// construct the module if needed
		if (typeof module === 'function') m = module(get);
		else m = module;

		// assign the module to whichever object is preferred
		if (isGlobal) global[key] = m;
		else _map[key] = m;
	}
function set ( key , module , global ) { var m = null ; var isGlobal = global && typeof global !== 'undefined' ; // check to make sure the module has been assigned only once if ( isGlobal ) { if ( global . hasOwnProperty ( key ) ) { throw '[define-shim] Module ' + key + ' already exists' ; } } else if ( _map . hasOwnProperty ( key ) ) { throw '[define-shim] Module ' + key + ' already exists' ; return ; } // construct the module if needed if ( typeof module === 'function' ) m = module ( get ) ; else m = module ; // assign the module to whichever object is preferred if ( isGlobal ) global [ key ] = m ; else _map [ key ] = m ; }
global is an optional object and will attach the constructed module to it if present
global is an optional object and will attach the constructed module to it if present