core-js 0.9.14 → 0.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +22 -5
  2. package/bower.json +1 -1
  3. package/build/build.ls +2 -1
  4. package/build/index.js +2 -2
  5. package/client/core.js +60 -44
  6. package/client/core.min.js +3 -3
  7. package/client/core.min.js.map +1 -1
  8. package/client/library.js +71 -78
  9. package/client/library.min.js +3 -3
  10. package/client/library.min.js.map +1 -1
  11. package/client/shim.js +60 -44
  12. package/client/shim.min.js +3 -3
  13. package/client/shim.min.js.map +1 -1
  14. package/library/modules/$.collection.js +22 -43
  15. package/library/modules/$.iter-define.js +1 -1
  16. package/library/modules/$.shared.js +1 -1
  17. package/library/modules/$.task.js +3 -5
  18. package/library/modules/$.unscope.js +1 -7
  19. package/library/modules/es6.math.js +11 -8
  20. package/library/modules/es6.promise.js +27 -9
  21. package/library/modules/es6.weak-map.js +1 -1
  22. package/library/modules/es7.observable.js +158 -0
  23. package/library/modules/es7.regexp.escape.js +3 -3
  24. package/library/modules/library/modules/$.collection.js +49 -0
  25. package/library/modules/library/modules/$.unscope.js +1 -0
  26. package/modules/$.collection.js +9 -12
  27. package/modules/$.iter-define.js +1 -1
  28. package/modules/$.shared.js +1 -1
  29. package/modules/$.task.js +3 -5
  30. package/modules/$.unscope.js +3 -4
  31. package/modules/es6.math.js +11 -8
  32. package/modules/es6.promise.js +27 -9
  33. package/modules/es6.weak-map.js +1 -1
  34. package/modules/es7.observable.js +158 -0
  35. package/modules/es7.regexp.escape.js +3 -3
  36. package/modules/library/modules/$.collection.js +49 -0
  37. package/modules/library/modules/$.unscope.js +1 -0
  38. package/package.json +3 -3
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
  var $ = require('./$')
3
3
  , $def = require('./$.def')
4
- , BUGGY = require('./$.iter').BUGGY
4
+ , $iter = require('./$.iter')
5
+ , BUGGY = $iter.BUGGY
5
6
  , forOf = require('./$.for-of')
6
- , species = require('./$.species')
7
- , assertInstance = require('./$.assert').inst;
7
+ , assertInstance = require('./$.assert').inst
8
+ , INTERNAL = require('./$.uid').safe('internal');
8
9
 
9
10
  module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
10
11
  var Base = $.g[NAME]
@@ -12,57 +13,35 @@ module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
12
13
  , ADDER = IS_MAP ? 'set' : 'add'
13
14
  , proto = C && C.prototype
14
15
  , O = {};
15
- function fixMethod(KEY){
16
- if($.FW){
17
- var fn = proto[KEY];
18
- require('./$.redef')(proto, KEY,
19
- KEY == 'delete' ? function(a){ return fn.call(this, a === 0 ? 0 : a); }
20
- : KEY == 'has' ? function has(a){ return fn.call(this, a === 0 ? 0 : a); }
21
- : KEY == 'get' ? function get(a){ return fn.call(this, a === 0 ? 0 : a); }
22
- : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
23
- : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
24
- );
25
- }
26
- }
27
- if(!$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){
16
+ if(!$.DESC || !$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){
28
17
  // create collection constructor
29
18
  C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
30
19
  require('./$.mix')(C.prototype, methods);
31
- C.prototype.constructor = C;
32
20
  } else {
33
- var inst = new C
34
- , chain = inst[ADDER](IS_WEAK ? {} : -0, 1)
35
- , buggyZero;
36
- // wrap for init collections from iterable
37
- if(!require('./$.iter-detect')(function(iter){ new C(iter); })){ // eslint-disable-line no-new
38
- C = wrapper(function(target, iterable){
39
- assertInstance(target, C, NAME);
40
- var that = new Base;
41
- if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
42
- return that;
21
+ C = wrapper(function(target, iterable){
22
+ assertInstance(target, C, NAME);
23
+ target[INTERNAL] = new Base;
24
+ if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target);
25
+ });
26
+ $.each.call('add,clear,delete,forEach,get,has,set,keys,values,entries'.split(','),function(KEY){
27
+ var chain = KEY == 'add' || KEY == 'set';
28
+ if(KEY in proto)$.hide(C.prototype, KEY, function(a, b){
29
+ var result = this[INTERNAL][KEY](a === 0 ? 0 : a, b);
30
+ return chain ? this : result;
43
31
  });
44
- C.prototype = proto;
45
- if($.FW)proto.constructor = C;
46
- }
47
- IS_WEAK || inst.forEach(function(val, key){
48
- buggyZero = 1 / key === -Infinity;
49
32
  });
50
- // fix converting -0 key to +0
51
- if(buggyZero){
52
- fixMethod('delete');
53
- fixMethod('has');
54
- IS_MAP && fixMethod('get');
55
- }
56
- // + fix .add & .set for chaining
57
- if(buggyZero || chain !== inst)fixMethod(ADDER);
33
+ if('size' in proto)$.setDesc(C.prototype, 'size', {
34
+ get: function(){
35
+ return this[INTERNAL].size;
36
+ }
37
+ });
58
38
  }
59
39
 
60
40
  require('./$.cof').set(C, NAME);
61
41
 
62
42
  O[NAME] = C;
63
- $def($def.G + $def.W + $def.F * (C != Base), O);
64
- species(C);
65
- species($.core[NAME]); // for wrapper
43
+ $def($def.G + $def.W + $def.F, O);
44
+ require('./$.species')(C);
66
45
 
67
46
  if(!IS_WEAK)common.setIter(C, NAME, IS_MAP);
68
47
 
@@ -33,7 +33,7 @@ module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE)
33
33
  if($.FW && $.has(proto, FF_ITERATOR))$iter.set(IteratorPrototype, $.that);
34
34
  }
35
35
  // Define iterator
36
- if($.FW)$iter.set(proto, _default);
36
+ if($.FW || FORCE)$iter.set(proto, _default);
37
37
  // Plug for library
38
38
  Iterators[NAME] = _default;
39
39
  Iterators[TAG] = $.that;
@@ -1,6 +1,6 @@
1
1
  var $ = require('./$')
2
2
  , SHARED = '__core-js_shared__'
3
- , store = $.g[SHARED] || $.hide($.g, SHARED, {})[SHARED];
3
+ , store = $.g[SHARED] || ($.g[SHARED] = {});
4
4
  module.exports = function(key){
5
5
  return store[key] || (store[key] = {});
6
6
  };
@@ -10,8 +10,6 @@ var $ = require('./$')
10
10
  , process = global.process
11
11
  , setTask = global.setImmediate
12
12
  , clearTask = global.clearImmediate
13
- , postMessage = global.postMessage
14
- , addEventListener = global.addEventListener
15
13
  , MessageChannel = global.MessageChannel
16
14
  , counter = 0
17
15
  , queue = {}
@@ -49,11 +47,11 @@ if(!isFunction(setTask) || !isFunction(clearTask)){
49
47
  };
50
48
  // Modern browsers, skip implementation for WebWorkers
51
49
  // IE8 has postMessage, but it's sync & typeof its postMessage is object
52
- } else if(addEventListener && isFunction(postMessage) && !global.importScripts){
50
+ } else if(global.addEventListener && isFunction(global.postMessage) && !global.importScripts){
53
51
  defer = function(id){
54
- postMessage(id, '*');
52
+ global.postMessage(id, '*');
55
53
  };
56
- addEventListener('message', listner, false);
54
+ global.addEventListener('message', listner, false);
57
55
  // WebWorkers
58
56
  } else if(isFunction(MessageChannel)){
59
57
  channel = new MessageChannel;
@@ -1,7 +1 @@
1
- // 22.1.3.31 Array.prototype[@@unscopables]
2
- var $ = require('./$')
3
- , UNSCOPABLES = require('./$.wks')('unscopables');
4
- if($.FW && !(UNSCOPABLES in []))$.hide(Array.prototype, UNSCOPABLES, {});
5
- module.exports = function(key){
6
- if($.FW)[][UNSCOPABLES][key] = true;
7
- };
1
+ module.exports = function(){ /* empty */ };
@@ -70,17 +70,20 @@ $def($def.S, 'Math', {
70
70
  var sum = 0
71
71
  , i = 0
72
72
  , len = arguments.length
73
- , args = Array(len)
74
73
  , larg = 0
75
- , arg;
74
+ , arg, div;
76
75
  while(i < len){
77
- arg = args[i] = abs(arguments[i++]);
78
- if(arg == Infinity)return Infinity;
79
- if(arg > larg)larg = arg;
76
+ arg = abs(arguments[i++]);
77
+ if(larg < arg){
78
+ div = larg / arg;
79
+ sum = sum * div * div + 1;
80
+ larg = arg;
81
+ } else if(arg > 0){
82
+ div = arg / larg;
83
+ sum += div * div;
84
+ } else sum += arg;
80
85
  }
81
- larg = larg || 1;
82
- while(len--)sum += pow(args[len] / larg, 2);
83
- return larg * sqrt(sum);
86
+ return larg === Infinity ? Infinity : larg * sqrt(sum);
84
87
  },
85
88
  // 20.2.2.18 Math.imul(x, y)
86
89
  imul: function imul(x, y){
@@ -13,6 +13,7 @@ var $ = require('./$')
13
13
  , PROMISE = 'Promise'
14
14
  , global = $.g
15
15
  , process = global.process
16
+ , isNode = cof(process) == 'process'
16
17
  , asap = process && process.nextTick || require('./$.task').set
17
18
  , P = global[PROMISE]
18
19
  , isFunction = $.isFunction
@@ -42,6 +43,14 @@ var useNative = function(){
42
43
  if(!(P2.resolve(5).then(function(){}) instanceof P2)){
43
44
  works = false;
44
45
  }
46
+ // actual V8 bug, https://code.google.com/p/v8/issues/detail?id=4162
47
+ if(works && $.DESC){
48
+ var thenableThenGotten = false;
49
+ P.resolve($.setDesc({}, 'then', {
50
+ get: function(){ thenableThenGotten = true; }
51
+ }));
52
+ works = thenableThenGotten;
53
+ }
45
54
  } catch(e){ works = false; }
46
55
  return works;
47
56
  }();
@@ -66,7 +75,8 @@ function isThenable(it){
66
75
  }
67
76
  function notify(record){
68
77
  var chain = record.c;
69
- if(chain.length)asap(function(){
78
+ // strange IE + webpack dev server bug - use .call(global)
79
+ if(chain.length)asap.call(global, function(){
70
80
  var value = record.v
71
81
  , ok = record.s == 1
72
82
  , i = 0;
@@ -112,11 +122,12 @@ function $reject(value){
112
122
  record.s = 2;
113
123
  record.a = record.c.slice();
114
124
  setTimeout(function(){
115
- asap(function(){
125
+ // strange IE + webpack dev server bug - use .call(global)
126
+ asap.call(global, function(){
116
127
  if(isUnhandled(promise = record.p)){
117
- if(cof(process) == 'process'){
128
+ if(isNode){
118
129
  process.emit('unhandledRejection', value, promise);
119
- } else if(global.console && isFunction(console.error)){
130
+ } else if(global.console && console.error){
120
131
  console.error('Unhandled promise rejection', value);
121
132
  }
122
133
  }
@@ -127,21 +138,28 @@ function $reject(value){
127
138
  }
128
139
  function $resolve(value){
129
140
  var record = this
130
- , then, wrapper;
141
+ , then;
131
142
  if(record.d)return;
132
143
  record.d = true;
133
144
  record = record.r || record; // unwrap
134
145
  try {
135
146
  if(then = isThenable(value)){
136
- wrapper = {r: record, d: false}; // wrap
137
- then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
147
+ // strange IE + webpack dev server bug - use .call(global)
148
+ asap.call(global, function(){
149
+ var wrapper = {r: record, d: false}; // wrap
150
+ try {
151
+ then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
152
+ } catch(e){
153
+ $reject.call(wrapper, e);
154
+ }
155
+ });
138
156
  } else {
139
157
  record.v = value;
140
158
  record.s = 1;
141
159
  notify(record);
142
160
  }
143
- } catch(err){
144
- $reject.call(wrapper || {r: record, d: false}, err); // wrap
161
+ } catch(e){
162
+ $reject.call({r: record, d: false}, e); // wrap
145
163
  }
146
164
  }
147
165
 
@@ -27,7 +27,7 @@ var $WeakMap = require('./$.collection')('WeakMap', function(get){
27
27
  }, weak, true, true);
28
28
 
29
29
  // IE11 WeakMap frozen keys fix
30
- if($.FW && new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
30
+ if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
31
31
  $.each.call(['delete', 'has', 'get', 'set'], function(key){
32
32
  var proto = $WeakMap.prototype
33
33
  , method = proto[key];
@@ -0,0 +1,158 @@
1
+ // Based on https://github.com/zenparsing/es-observable/blob/master/src/Observable.js
2
+ var $ = require('./$')
3
+ , $def = require('./$.def')
4
+ , $redef = require('./$.redef')
5
+ , $mix = require('./$.mix')
6
+ , asap = require('./$.task').set
7
+ , assert = require('./$.assert')
8
+ , OBSERVER = require('./$.wks')('observer')
9
+ , isFunction = $.isFunction
10
+ , assertObject = assert.obj
11
+ , assertFunction = assert.fn;
12
+
13
+ // === Abstract Operations ===
14
+ function cancelSubscription(observer){
15
+ var subscription = observer._subscription;
16
+ if(!subscription)return;
17
+ // Drop the reference to the subscription so that we don't unsubscribe
18
+ // more than once
19
+ observer._subscription = undefined;
20
+ try {
21
+ // Call the unsubscribe function
22
+ subscription.unsubscribe();
23
+ } finally {
24
+ // Drop the reference to the inner observer so that no more notifications
25
+ // will be sent
26
+ observer._observer = undefined;
27
+ }
28
+ }
29
+
30
+ function closeSubscription(observer){
31
+ observer._observer = undefined;
32
+ cancelSubscription(observer);
33
+ }
34
+
35
+ function hasUnsubscribe(x){
36
+ return $.isObject(x) && isFunction(x.unsubscribe);
37
+ }
38
+
39
+ function SubscriptionObserver(observer){
40
+ this._observer = observer;
41
+ this._subscription = undefined;
42
+ }
43
+ $mix(SubscriptionObserver.prototype, {
44
+ next: function(value){
45
+ var observer = this._observer
46
+ , result;
47
+ // If the stream if closed, then return a "done" result
48
+ if(!observer)return { value: undefined, done: true };
49
+ try {
50
+ // Send the next value to the sink
51
+ result = observer.next(value);
52
+ } catch (e) {
53
+ // If the observer throws, then close the stream and rethrow the error
54
+ closeSubscription(this);
55
+ throw e;
56
+ }
57
+ // Cleanup if sink is closed
58
+ if(result && result.done)closeSubscription(this);
59
+ return result;
60
+ },
61
+ 'throw': function(value){
62
+ var observer = this._observer;
63
+ // If the stream is closed, throw the error to the caller
64
+ if(!observer)throw value;
65
+ this._observer = undefined;
66
+ try {
67
+ // If the sink does not support "throw", then throw the error to the caller
68
+ if(!('throw' in observer))throw value;
69
+ return observer['throw'](value);
70
+ } finally {
71
+ cancelSubscription(this);
72
+ }
73
+ },
74
+ 'return': function(value){
75
+ var observer = this._observer;
76
+ // If the stream is closed, then return a done result
77
+ if (!observer)return {value: value, done: true};
78
+ this._observer = undefined;
79
+ try {
80
+ // If the sink does not support "return", then return a done result
81
+ if (!('return' in observer))return {value: value, done: true};
82
+ return observer['return'](value);
83
+ } finally {
84
+ cancelSubscription(this);
85
+ }
86
+ }
87
+ });
88
+
89
+ function Observable(subscriber){
90
+ // The stream subscriber must be a function
91
+ this._subscriber = assertFunction(subscriber);
92
+ }
93
+ $mix(Observable.prototype, {
94
+ subscribe: function(observer){
95
+ // The sink must be an object
96
+ assertObject(observer);
97
+ var unsubscribed = false
98
+ , that = this
99
+ , subscription;
100
+ asap.call(global, function(){
101
+ if(!unsubscribed)subscription = that[OBSERVER](observer);
102
+ });
103
+ return {
104
+ unsubscribe: function(){
105
+ if(unsubscribed)return;
106
+ unsubscribed = true;
107
+ if(subscription)subscription.unsubscribe();
108
+ }
109
+ };
110
+ },
111
+ forEach: function(fn, thisArg){
112
+ var that = this;
113
+ return new ($.core.Promise || $.g.Promise)(function(resolve, reject){
114
+ assertFunction(fn);
115
+ that.subscribe({
116
+ next: function(value){ fn.call(thisArg, value); },
117
+ 'throw': function(value){ reject(value); },
118
+ 'return': function(){ resolve(undefined); }
119
+ });
120
+ });
121
+ }
122
+ });
123
+ $redef(Observable.prototype, OBSERVER, function(observer){
124
+ // The sink must be an object
125
+ // Wrap the observer in order to maintain observation invariants
126
+ observer = new SubscriptionObserver(assertObject(observer));
127
+ var subscription;
128
+ try {
129
+ // Call the subscriber function
130
+ subscription = this._subscriber.call(undefined, observer);
131
+ if(!hasUnsubscribe(subscription)){
132
+ var unsubscribe = isFunction(subscription)
133
+ ? subscription
134
+ : function(){ observer['return'](); };
135
+ subscription = {unsubscribe: unsubscribe};
136
+ }
137
+ } catch(e){
138
+ // If an error occurs during startup, then attempt to send the error
139
+ // to the observer
140
+ observer['throw'](e);
141
+ }
142
+ observer._subscription = subscription;
143
+ // If the stream is already finished, then perform cleanup
144
+ if(!observer._observer)cancelSubscription(observer);
145
+ // Return the subscription object
146
+ return subscription;
147
+ });
148
+ $redef(Observable, 'from', function(x){
149
+ if(assertObject(x)._subscriber && x.constructor === this)return x;
150
+ var subscribeFunction = assertFunction(x[OBSERVER]);
151
+ return new this(function(sink){
152
+ subscribeFunction.call(x, sink);
153
+ });
154
+ });
155
+
156
+
157
+ $def($def.G + $def.F, {Observable: Observable});
158
+ $def($def.S, 'Symbol', {observer: OBSERVER});
@@ -1,5 +1,5 @@
1
- // https://gist.github.com/kangax/9698100
1
+ // https://github.com/benjamingr/RexExp.escape
2
2
  var $def = require('./$.def');
3
3
  $def($def.S, 'RegExp', {
4
- escape: require('./$.replacer')(/([\\\-[\]{}()*+?.,^$|])/g, '\\$1', true)
5
- });
4
+ escape: require('./$.replacer')(/[\\^$*+?.()|[\]{}]/g, '\\$&', true)
5
+ });
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+ var $ = require('./$')
3
+ , $def = require('./$.def')
4
+ , $iter = require('./$.iter')
5
+ , BUGGY = $iter.BUGGY
6
+ , forOf = require('./$.for-of')
7
+ , assertInstance = require('./$.assert').inst
8
+ , INTERNAL = require('./$.uid').safe('internal');
9
+
10
+ module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
11
+ var Base = $.g[NAME]
12
+ , C = Base
13
+ , ADDER = IS_MAP ? 'set' : 'add'
14
+ , proto = C && C.prototype
15
+ , O = {};
16
+ if(!$.DESC || !$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){
17
+ // create collection constructor
18
+ C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
19
+ require('./$.mix')(C.prototype, methods);
20
+ } else {
21
+ C = wrapper(function(target, iterable){
22
+ assertInstance(target, C, NAME);
23
+ target[INTERNAL] = new Base;
24
+ if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target);
25
+ });
26
+ $.each.call('add,clear,delete,forEach,get,has,set,keys,values,entries'.split(','),function(KEY){
27
+ var chain = KEY == 'add' || KEY == 'set';
28
+ if(KEY in proto)$.hide(C.prototype, KEY, function(a, b){
29
+ var result = this[INTERNAL][KEY](a === 0 ? 0 : a, b);
30
+ return chain ? this : result;
31
+ });
32
+ });
33
+ if('size' in proto)$.setDesc(C.prototype, 'size', {
34
+ get: function(){
35
+ return this[INTERNAL].size;
36
+ }
37
+ });
38
+ }
39
+
40
+ require('./$.cof').set(C, NAME);
41
+
42
+ O[NAME] = C;
43
+ $def($def.G + $def.W + $def.F, O);
44
+ require('./$.species')(C);
45
+
46
+ if(!IS_WEAK)common.setIter(C, NAME, IS_MAP);
47
+
48
+ return C;
49
+ };
@@ -0,0 +1 @@
1
+ module.exports = function(){ /* empty */ };
@@ -13,22 +13,19 @@ module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
13
13
  , proto = C && C.prototype
14
14
  , O = {};
15
15
  function fixMethod(KEY){
16
- if($.FW){
17
- var fn = proto[KEY];
18
- require('./$.redef')(proto, KEY,
19
- KEY == 'delete' ? function(a){ return fn.call(this, a === 0 ? 0 : a); }
20
- : KEY == 'has' ? function has(a){ return fn.call(this, a === 0 ? 0 : a); }
21
- : KEY == 'get' ? function get(a){ return fn.call(this, a === 0 ? 0 : a); }
22
- : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
23
- : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
24
- );
25
- }
16
+ var fn = proto[KEY];
17
+ require('./$.redef')(proto, KEY,
18
+ KEY == 'delete' ? function(a){ return fn.call(this, a === 0 ? 0 : a); }
19
+ : KEY == 'has' ? function has(a){ return fn.call(this, a === 0 ? 0 : a); }
20
+ : KEY == 'get' ? function get(a){ return fn.call(this, a === 0 ? 0 : a); }
21
+ : KEY == 'add' ? function add(a){ fn.call(this, a === 0 ? 0 : a); return this; }
22
+ : function set(a, b){ fn.call(this, a === 0 ? 0 : a, b); return this; }
23
+ );
26
24
  }
27
25
  if(!$.isFunction(C) || !(IS_WEAK || !BUGGY && proto.forEach && proto.entries)){
28
26
  // create collection constructor
29
27
  C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
30
28
  require('./$.mix')(C.prototype, methods);
31
- C.prototype.constructor = C;
32
29
  } else {
33
30
  var inst = new C
34
31
  , chain = inst[ADDER](IS_WEAK ? {} : -0, 1)
@@ -42,7 +39,7 @@ module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
42
39
  return that;
43
40
  });
44
41
  C.prototype = proto;
45
- if($.FW)proto.constructor = C;
42
+ proto.constructor = C;
46
43
  }
47
44
  IS_WEAK || inst.forEach(function(val, key){
48
45
  buggyZero = 1 / key === -Infinity;
@@ -33,7 +33,7 @@ module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCE)
33
33
  if($.FW && $.has(proto, FF_ITERATOR))$iter.set(IteratorPrototype, $.that);
34
34
  }
35
35
  // Define iterator
36
- if($.FW)$iter.set(proto, _default);
36
+ if($.FW || FORCE)$iter.set(proto, _default);
37
37
  // Plug for library
38
38
  Iterators[NAME] = _default;
39
39
  Iterators[TAG] = $.that;
@@ -1,6 +1,6 @@
1
1
  var $ = require('./$')
2
2
  , SHARED = '__core-js_shared__'
3
- , store = $.g[SHARED] || $.hide($.g, SHARED, {})[SHARED];
3
+ , store = $.g[SHARED] || ($.g[SHARED] = {});
4
4
  module.exports = function(key){
5
5
  return store[key] || (store[key] = {});
6
6
  };
package/modules/$.task.js CHANGED
@@ -10,8 +10,6 @@ var $ = require('./$')
10
10
  , process = global.process
11
11
  , setTask = global.setImmediate
12
12
  , clearTask = global.clearImmediate
13
- , postMessage = global.postMessage
14
- , addEventListener = global.addEventListener
15
13
  , MessageChannel = global.MessageChannel
16
14
  , counter = 0
17
15
  , queue = {}
@@ -49,11 +47,11 @@ if(!isFunction(setTask) || !isFunction(clearTask)){
49
47
  };
50
48
  // Modern browsers, skip implementation for WebWorkers
51
49
  // IE8 has postMessage, but it's sync & typeof its postMessage is object
52
- } else if(addEventListener && isFunction(postMessage) && !global.importScripts){
50
+ } else if(global.addEventListener && isFunction(global.postMessage) && !global.importScripts){
53
51
  defer = function(id){
54
- postMessage(id, '*');
52
+ global.postMessage(id, '*');
55
53
  };
56
- addEventListener('message', listner, false);
54
+ global.addEventListener('message', listner, false);
57
55
  // WebWorkers
58
56
  } else if(isFunction(MessageChannel)){
59
57
  channel = new MessageChannel;
@@ -1,7 +1,6 @@
1
1
  // 22.1.3.31 Array.prototype[@@unscopables]
2
- var $ = require('./$')
3
- , UNSCOPABLES = require('./$.wks')('unscopables');
4
- if($.FW && !(UNSCOPABLES in []))$.hide(Array.prototype, UNSCOPABLES, {});
2
+ var UNSCOPABLES = require('./$.wks')('unscopables');
3
+ if(!(UNSCOPABLES in []))require('./$').hide(Array.prototype, UNSCOPABLES, {});
5
4
  module.exports = function(key){
6
- if($.FW)[][UNSCOPABLES][key] = true;
5
+ [][UNSCOPABLES][key] = true;
7
6
  };
@@ -70,17 +70,20 @@ $def($def.S, 'Math', {
70
70
  var sum = 0
71
71
  , i = 0
72
72
  , len = arguments.length
73
- , args = Array(len)
74
73
  , larg = 0
75
- , arg;
74
+ , arg, div;
76
75
  while(i < len){
77
- arg = args[i] = abs(arguments[i++]);
78
- if(arg == Infinity)return Infinity;
79
- if(arg > larg)larg = arg;
76
+ arg = abs(arguments[i++]);
77
+ if(larg < arg){
78
+ div = larg / arg;
79
+ sum = sum * div * div + 1;
80
+ larg = arg;
81
+ } else if(arg > 0){
82
+ div = arg / larg;
83
+ sum += div * div;
84
+ } else sum += arg;
80
85
  }
81
- larg = larg || 1;
82
- while(len--)sum += pow(args[len] / larg, 2);
83
- return larg * sqrt(sum);
86
+ return larg === Infinity ? Infinity : larg * sqrt(sum);
84
87
  },
85
88
  // 20.2.2.18 Math.imul(x, y)
86
89
  imul: function imul(x, y){