1 var global = require('./_global')
2 , core = require('./_core')
3 , hide = require('./_hide')
4 , redefine = require('./_redefine')
5 , ctx = require('./_ctx')
6 , PROTOTYPE = 'prototype';
8 var $export = function(type, name, source){
9 var IS_FORCED = type & $export.F
10 , IS_GLOBAL = type & $export.G
11 , IS_STATIC = type & $export.S
12 , IS_PROTO = type & $export.P
13 , IS_BIND = type & $export.B
14 , target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]
15 , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
16 , expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {})
18 if(IS_GLOBAL)source = name;
21 own = !IS_FORCED && target && target[key] !== undefined;
22 // export native or passed
23 out = (own ? target : source)[key];
24 // bind timers to global for call from export context
25 exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
27 if(target)redefine(target, key, out, type & $export.U);
29 if(exports[key] != out)hide(exports, key, exp);
30 if(IS_PROTO && expProto[key] != out)expProto[key] = out;
35 $export.F = 1; // forced
36 $export.G = 2; // global
37 $export.S = 4; // static
38 $export.P = 8; // proto
39 $export.B = 16; // bind
40 $export.W = 32; // wrap
41 $export.U = 64; // safe
42 $export.R = 128; // real proto method for `library`
43 module.exports = $export;