function (code, options) {
    var exports = [],
        requires = [],
        bind = [],
        extra_exports = options.extra_exports,
        extra_require = options.extra_require,
        extra_bind = options.extra_bind,
        exportCode,
        bindModuleName;

    // add exports to the module end
    // extra_exports = {name: code, name: code}
    if (typeof extra_exports === "object") {
        for (var exportName in extra_exports) {
            exportCode = extra_exports[exportName];
            exports.push('    ' + JSON.stringify(exportName) + ': ' + exportCode);
        }
        code += '\n\n/* added by builder */\nreturn {\n' + exports.join(',\n') + '\n};';
    } else if (extra_exports) {
        // extra_exports = string
        code += '\n\n/* added by builder */\nreturn ' + extra_exports + ';';
    }

    // change context of module (this)
    // and proxy return value
    // return function(){}.call({name: require('name')});
    if (typeof extra_bind === "object") {
        for (var bindName in extra_bind) {
            bindModuleName = extra_bind[bindName];
            bind.push('    ' + JSON.stringify(bindName) + ': require(' + JSON.stringify(bindModuleName) + ')');
        }
        code = '\nreturn function(){\n\n' + code + '\n}.call({\n' + bind.join(',\n') + '\n});';
    } else if (extra_bind) {
        // return function(){}.call(require('name'));
        code = '\nreturn function(){\n\n' + code + '\n}.call(require(' + JSON.stringify(extra_bind) + '));';
    }

    // add require to the module start
    if (typeof extra_require === "object") {
        // extra_require = [name, name, name]
        if (extra_require instanceof Array) {
            for (var i = 0, c = extra_require.length, moduleName; i < c; i++) {
                moduleName = extra_require[i];
                requires.push('require(' + JSON.stringify(moduleName) + ');');
            }
            code = '/* added by builder */\n' + requires.join('\n') + '\n\n' + code;
        } else {
            // extra_require = {name: name, name: name}
            for (var localName in extra_require) {
                moduleName = extra_require[localName];
                requires.push(localName + ' = require(' + JSON.stringify(moduleName) + ')');
            }
            code = '/* added by builder */\nvar ' + requires.join(',\n    ') + ';\n\n' + code;
        }
    } else if (extra_require) {
        // extra_require = string
        code = '/* added by builder */\nrequire(' + JSON.stringify(extra_require) + ');\n\n' + code;
    }

    return '(function (require) { /* wrapped by builder */\n' + code + '\n})';
}
function (code, options) {
    var exports = [],
        requires = [],
        bind = [],
        extra_exports = options.extra_exports,
        extra_require = options.extra_require,
        extra_bind = options.extra_bind,
        exportCode,
        bindModuleName;

    // add exports to the module end
    // extra_exports = {name: code, name: code}
    if (typeof extra_exports === "object") {
        for (var exportName in extra_exports) {
            exportCode = extra_exports[exportName];
            exports.push('    ' + JSON.stringify(exportName) + ': ' + exportCode);
        }
        code += '\n\n/* added by builder */\nreturn {\n' + exports.join(',\n') + '\n};';
    } else if (extra_exports) {
        // extra_exports = string
        code += '\n\n/* added by builder */\nreturn ' + extra_exports + ';';
    }

    // change context of module (this)
    // and proxy return value
    // return function(){}.call({name: require('name')});
    if (typeof extra_bind === "object") {
        for (var bindName in extra_bind) {
            bindModuleName = extra_bind[bindName];
            bind.push('    ' + JSON.stringify(bindName) + ': require(' + JSON.stringify(bindModuleName) + ')');
        }
        code = '\nreturn function(){\n\n' + code + '\n}.call({\n' + bind.join(',\n') + '\n});';
    } else if (extra_bind) {
        // return function(){}.call(require('name'));
        code = '\nreturn function(){\n\n' + code + '\n}.call(require(' + JSON.stringify(extra_bind) + '));';
    }

    // add require to the module start
    if (typeof extra_require === "object") {
        // extra_require = [name, name, name]
        if (extra_require instanceof Array) {
            for (var i = 0, c = extra_require.length, moduleName; i < c; i++) {
                moduleName = extra_require[i];
                requires.push('require(' + JSON.stringify(moduleName) + ');');
            }
            code = '/* added by builder */\n' + requires.join('\n') + '\n\n' + code;
        } else {
            // extra_require = {name: name, name: name}
            for (var localName in extra_require) {
                moduleName = extra_require[localName];
                requires.push(localName + ' = require(' + JSON.stringify(moduleName) + ')');
            }
            code = '/* added by builder */\nvar ' + requires.join(',\n    ') + ';\n\n' + code;
        }
    } else if (extra_require) {
        // extra_require = string
        code = '/* added by builder */\nrequire(' + JSON.stringify(extra_require) + ');\n\n' + code;
    }

    return '(function (require) { /* wrapped by builder */\n' + code + '\n})';
}
function ( code , options ) { var exports = [ ] , requires = [ ] , bind = [ ] , extra_exports = options . extra_exports , extra_require = options . extra_require , extra_bind = options . extra_bind , exportCode , bindModuleName ; // add exports to the module end // extra_exports = {name: code, name: code} if ( typeof extra_exports === "object" ) { for ( var exportName in extra_exports ) { exportCode = extra_exports [ exportName ] ; exports . push ( '    ' + JSON . stringify ( exportName ) + ': ' + exportCode ) ; } code += '\n\n/* added by builder */\nreturn {\n' + exports . join ( ',\n' ) + '\n};' ; } else if ( extra_exports ) { // extra_exports = string code += '\n\n/* added by builder */\nreturn ' + extra_exports + ';' ; } // change context of module (this) // and proxy return value // return function(){}.call({name: require('name')}); if ( typeof extra_bind === "object" ) { for ( var bindName in extra_bind ) { bindModuleName = extra_bind [ bindName ] ; bind . push ( '    ' + JSON . stringify ( bindName ) + ': require(' + JSON . stringify ( bindModuleName ) + ')' ) ; } code = '\nreturn function(){\n\n' + code + '\n}.call({\n' + bind . join ( ',\n' ) + '\n});' ; } else if ( extra_bind ) { // return function(){}.call(require('name')); code = '\nreturn function(){\n\n' + code + '\n}.call(require(' + JSON . stringify ( extra_bind ) + '));' ; } // add require to the module start if ( typeof extra_require === "object" ) { // extra_require = [name, name, name] if ( extra_require instanceof Array ) { for ( var i = 0 , c = extra_require . length , moduleName ; i < c ; i ++ ) { moduleName = extra_require [ i ] ; requires . push ( 'require(' + JSON . stringify ( moduleName ) + ');' ) ; } code = '/* added by builder */\n' + requires . join ( '\n' ) + '\n\n' + code ; } else { // extra_require = {name: name, name: name} for ( var localName in extra_require ) { moduleName = extra_require [ localName ] ; requires . push ( localName + ' = require(' + JSON . stringify ( moduleName ) + ')' ) ; } code = '/* added by builder */\nvar ' + requires . join ( ',\n    ' ) + ';\n\n' + code ; } } else if ( extra_require ) { // extra_require = string code = '/* added by builder */\nrequire(' + JSON . stringify ( extra_require ) + ');\n\n' + code ; } return '(function (require) { /* wrapped by builder */\n' + code + '\n})' ; }
Wrapper for non-lmd modules files

@param {String}               code
@param {Object}               options
@param {Object|String}        options.extra_exports
@param {Object|String|String} options.extra_require
@param {Object|String|String} options.extra_bind

@returns {String} wrapped code
Wrapper for non - lmd modules files