2016-08-03 63 views

cevap

1

Çalışıyor.

(function(global) { 

    var defineAsGlobal = true; 
    /* istanbul ignore next */ 
    if(typeof exports === 'object') { 
     module.exports = lib; 
     defineAsGlobal = false; 
    } 
    /* istanbul ignore next */ 
    if(typeof modules === 'object' && typeof modules.define === 'function') { 
     modules.define('lib', function(provide) { 
      provide(lib); 
     }); 
     defineAsGlobal = false; 
    } 
    /* istanbul ignore next */ 
    if(typeof define === 'function') { 
     define(function(require, exports, module) { 
      module.exports = lib; 
     }); 
     defineAsGlobal = false; 
    } 
    /* istanbul ignore next */ 
    defineAsGlobal && (global.lib = lib); 
})(this); 

Örnek proje https://github.com/ilyar/sandbox/tree/master/jest