core-js 3.2.1 → 3.3.0
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.
- package/configurator.js +7 -0
- package/es/global-this.js +3 -0
- package/es/index.js +1 -0
- package/features/async-iterator/as-indexed-pairs.js +10 -0
- package/features/async-iterator/drop.js +10 -0
- package/features/async-iterator/every.js +10 -0
- package/features/async-iterator/filter.js +10 -0
- package/features/async-iterator/find.js +10 -0
- package/features/async-iterator/flat-map.js +10 -0
- package/features/async-iterator/for-each.js +10 -0
- package/features/async-iterator/from.js +10 -0
- package/features/async-iterator/index.js +22 -0
- package/features/async-iterator/map.js +10 -0
- package/features/async-iterator/reduce.js +10 -0
- package/features/async-iterator/some.js +10 -0
- package/features/async-iterator/take.js +10 -0
- package/features/async-iterator/to-array.js +10 -0
- package/features/global-this.js +1 -3
- package/features/iterator/as-indexed-pairs.js +10 -0
- package/features/iterator/drop.js +9 -0
- package/features/iterator/every.js +9 -0
- package/features/iterator/filter.js +9 -0
- package/features/iterator/find.js +9 -0
- package/features/iterator/flat-map.js +9 -0
- package/features/iterator/for-each.js +9 -0
- package/features/iterator/from.js +9 -0
- package/features/iterator/index.js +21 -0
- package/features/iterator/map.js +9 -0
- package/features/iterator/reduce.js +9 -0
- package/features/iterator/some.js +9 -0
- package/features/iterator/take.js +9 -0
- package/features/iterator/to-array.js +9 -0
- package/features/map/index.js +2 -0
- package/features/map/update-or-insert.js +1 -0
- package/features/map/upsert.js +5 -0
- package/features/weak-map/index.js +1 -0
- package/features/weak-map/upsert.js +5 -0
- package/internals/add-to-unscopables.js +2 -2
- package/internals/array-buffer-view-core.js +2 -2
- package/internals/array-buffer.js +9 -4
- package/internals/array-from.js +3 -2
- package/internals/async-iterator-iteration.js +61 -0
- package/internals/async-iterator-prototype.js +37 -0
- package/internals/create-async-iterator-proxy.js +61 -0
- package/internals/create-iterator-proxy.js +51 -0
- package/internals/{hide.js → create-non-enumerable-property.js} +0 -0
- package/internals/define-iterator.js +3 -3
- package/internals/export.js +2 -2
- package/internals/fix-regexp-well-known-symbol-logic.js +2 -2
- package/internals/get-async-iterator-method.js +9 -0
- package/internals/global.js +4 -5
- package/internals/internal-state.js +2 -2
- package/internals/iterate.js +4 -3
- package/internals/iterators-core.js +4 -2
- package/internals/map-upsert.js +23 -0
- package/internals/microtask.js +1 -1
- package/internals/native-url.js +13 -4
- package/internals/redefine.js +3 -3
- package/internals/set-global.js +2 -2
- package/internals/shared-store.js +7 -0
- package/internals/shared.js +2 -6
- package/internals/task.js +3 -1
- package/internals/to-offset.js +3 -3
- package/internals/to-positive-integer.js +7 -0
- package/internals/typed-array-constructor.js +10 -7
- package/internals/typed-array-from.js +3 -2
- package/modules/es.date.to-primitive.js +4 -2
- package/modules/es.global-this.js +8 -0
- package/modules/es.promise.js +2 -1
- package/modules/es.string.match-all.js +22 -7
- package/modules/es.symbol.js +4 -2
- package/modules/esnext.aggregate-error.js +28 -4
- package/modules/esnext.async-iterator.as-indexed-pairs.js +27 -0
- package/modules/esnext.async-iterator.constructor.js +25 -0
- package/modules/esnext.async-iterator.drop.js +41 -0
- package/modules/esnext.async-iterator.every.js +10 -0
- package/modules/esnext.async-iterator.filter.js +42 -0
- package/modules/esnext.async-iterator.find.js +10 -0
- package/modules/esnext.async-iterator.flat-map.js +67 -0
- package/modules/esnext.async-iterator.for-each.js +10 -0
- package/modules/esnext.async-iterator.from.js +30 -0
- package/modules/esnext.async-iterator.map.js +30 -0
- package/modules/esnext.async-iterator.reduce.js +46 -0
- package/modules/esnext.async-iterator.some.js +10 -0
- package/modules/esnext.async-iterator.take.js +22 -0
- package/modules/esnext.async-iterator.to-array.js +10 -0
- package/modules/esnext.global-this.js +2 -8
- package/modules/esnext.iterator.as-indexed-pairs.js +20 -0
- package/modules/esnext.iterator.constructor.js +39 -0
- package/modules/esnext.iterator.drop.js +30 -0
- package/modules/esnext.iterator.every.js +16 -0
- package/modules/esnext.iterator.filter.js +30 -0
- package/modules/esnext.iterator.find.js +16 -0
- package/modules/esnext.iterator.flat-map.js +45 -0
- package/modules/esnext.iterator.for-each.js +11 -0
- package/modules/esnext.iterator.from.js +32 -0
- package/modules/esnext.iterator.map.js +23 -0
- package/modules/esnext.iterator.reduce.js +25 -0
- package/modules/esnext.iterator.some.js +16 -0
- package/modules/esnext.iterator.take.js +25 -0
- package/modules/esnext.iterator.to-array.js +15 -0
- package/modules/esnext.map.reduce.js +9 -8
- package/modules/esnext.map.update-or-insert.js +5 -12
- package/modules/esnext.map.upsert.js +10 -0
- package/modules/esnext.math.signbit.js +0 -1
- package/modules/esnext.observable.js +2 -2
- package/modules/esnext.set.reduce.js +9 -8
- package/modules/esnext.string.match-all.js +0 -1
- package/modules/esnext.string.replace-all.js +13 -19
- package/modules/esnext.symbol.replace-all.js +1 -2
- package/modules/esnext.weak-map.upsert.js +10 -0
- package/modules/web.dom-collections.for-each.js +2 -2
- package/modules/web.dom-collections.iterator.js +6 -4
- package/modules/web.url-search-params.js +7 -5
- package/package.json +2 -2
- package/postinstall.js +49 -0
- package/proposals/iterator-helpers.js +20 -0
- package/proposals/map-update-or-insert.js +2 -1
- package/proposals/map-upsert.js +5 -0
- package/stable/global-this.js +1 -3
- package/stage/1.js +0 -1
- package/stage/2.js +2 -2
- package/stage/3.js +2 -1
- package/stage/4.js +1 -0
- package/LICENSE +0 -19
- package/scripts/postinstall.js +0 -24
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
3
|
+
var $ = require('../internals/export');
|
|
4
|
+
var iterate = require('../internals/iterate');
|
|
5
|
+
var anObject = require('../internals/an-object');
|
|
6
|
+
|
|
7
|
+
$({ target: 'Iterator', proto: true, real: true }, {
|
|
8
|
+
forEach: function forEach(fn) {
|
|
9
|
+
iterate(anObject(this), fn, undefined, false, true);
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
2
|
+
var $ = require('../internals/export');
|
|
3
|
+
var path = require('../internals/path');
|
|
4
|
+
var aFunction = require('../internals/a-function');
|
|
5
|
+
var anObject = require('../internals/an-object');
|
|
6
|
+
var toObject = require('../internals/to-object');
|
|
7
|
+
var createIteratorProxy = require('../internals/create-iterator-proxy');
|
|
8
|
+
var getIteratorMethod = require('../internals/get-iterator-method');
|
|
9
|
+
|
|
10
|
+
var Iterator = path.Iterator;
|
|
11
|
+
|
|
12
|
+
var IteratorProxy = createIteratorProxy(function (arg) {
|
|
13
|
+
var result = anObject(this.next.call(this.iterator, arg));
|
|
14
|
+
var done = this.done = !!result.done;
|
|
15
|
+
if (!done) return result.value;
|
|
16
|
+
}, true);
|
|
17
|
+
|
|
18
|
+
$({ target: 'Iterator', stat: true }, {
|
|
19
|
+
from: function from(O) {
|
|
20
|
+
var object = toObject(O);
|
|
21
|
+
var usingIterator = getIteratorMethod(object);
|
|
22
|
+
var iterator;
|
|
23
|
+
if (usingIterator != null) {
|
|
24
|
+
iterator = aFunction(usingIterator).call(object);
|
|
25
|
+
if (iterator instanceof Iterator) return iterator;
|
|
26
|
+
} else {
|
|
27
|
+
iterator = object;
|
|
28
|
+
} return new IteratorProxy({
|
|
29
|
+
iterator: iterator
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
3
|
+
var $ = require('../internals/export');
|
|
4
|
+
var aFunction = require('../internals/a-function');
|
|
5
|
+
var anObject = require('../internals/an-object');
|
|
6
|
+
var createIteratorProxy = require('../internals/create-iterator-proxy');
|
|
7
|
+
var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');
|
|
8
|
+
|
|
9
|
+
var IteratorProxy = createIteratorProxy(function (arg) {
|
|
10
|
+
var iterator = this.iterator;
|
|
11
|
+
var result = anObject(this.next.call(iterator, arg));
|
|
12
|
+
var done = this.done = !!result.done;
|
|
13
|
+
if (!done) return callWithSafeIterationClosing(iterator, this.mapper, result.value);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
$({ target: 'Iterator', proto: true, real: true }, {
|
|
17
|
+
map: function map(mapper) {
|
|
18
|
+
return new IteratorProxy({
|
|
19
|
+
iterator: anObject(this),
|
|
20
|
+
mapper: aFunction(mapper)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
3
|
+
var $ = require('../internals/export');
|
|
4
|
+
var iterate = require('../internals/iterate');
|
|
5
|
+
var aFunction = require('../internals/a-function');
|
|
6
|
+
var anObject = require('../internals/an-object');
|
|
7
|
+
|
|
8
|
+
$({ target: 'Iterator', proto: true, real: true }, {
|
|
9
|
+
reduce: function reduce(reducer /* , initialValue */) {
|
|
10
|
+
anObject(this);
|
|
11
|
+
aFunction(reducer);
|
|
12
|
+
var noInitial = arguments.length < 2;
|
|
13
|
+
var accumulator = noInitial ? undefined : arguments[1];
|
|
14
|
+
iterate(this, function (value) {
|
|
15
|
+
if (noInitial) {
|
|
16
|
+
noInitial = false;
|
|
17
|
+
accumulator = value;
|
|
18
|
+
} else {
|
|
19
|
+
accumulator = reducer(accumulator, value);
|
|
20
|
+
}
|
|
21
|
+
}, undefined, false, true);
|
|
22
|
+
if (noInitial) throw TypeError('Reduce of empty iterator with no initial value');
|
|
23
|
+
return accumulator;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
3
|
+
var $ = require('../internals/export');
|
|
4
|
+
var iterate = require('../internals/iterate');
|
|
5
|
+
var aFunction = require('../internals/a-function');
|
|
6
|
+
var anObject = require('../internals/an-object');
|
|
7
|
+
|
|
8
|
+
$({ target: 'Iterator', proto: true, real: true }, {
|
|
9
|
+
some: function some(fn) {
|
|
10
|
+
anObject(this);
|
|
11
|
+
aFunction(fn);
|
|
12
|
+
return iterate(this, function (value) {
|
|
13
|
+
if (fn(value)) return iterate.stop();
|
|
14
|
+
}, undefined, false, true).stopped;
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
3
|
+
var $ = require('../internals/export');
|
|
4
|
+
var anObject = require('../internals/an-object');
|
|
5
|
+
var toPositiveInteger = require('../internals/to-positive-integer');
|
|
6
|
+
var createIteratorProxy = require('../internals/create-iterator-proxy');
|
|
7
|
+
|
|
8
|
+
var IteratorProxy = createIteratorProxy(function (arg) {
|
|
9
|
+
if (!this.remaining--) {
|
|
10
|
+
this.done = true;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
var result = anObject(this.next.call(this.iterator, arg));
|
|
14
|
+
var done = this.done = !!result.done;
|
|
15
|
+
if (!done) return result.value;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
$({ target: 'Iterator', proto: true, real: true }, {
|
|
19
|
+
take: function take(limit) {
|
|
20
|
+
return new IteratorProxy({
|
|
21
|
+
iterator: anObject(this),
|
|
22
|
+
remaining: toPositiveInteger(limit)
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// https://github.com/tc39/proposal-iterator-helpers
|
|
3
|
+
var $ = require('../internals/export');
|
|
4
|
+
var iterate = require('../internals/iterate');
|
|
5
|
+
var anObject = require('../internals/an-object');
|
|
6
|
+
|
|
7
|
+
var push = [].push;
|
|
8
|
+
|
|
9
|
+
$({ target: 'Iterator', proto: true, real: true }, {
|
|
10
|
+
toArray: function toArray() {
|
|
11
|
+
var result = [];
|
|
12
|
+
iterate(anObject(this), push, result, false, true);
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -12,17 +12,18 @@ $({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
|
|
|
12
12
|
reduce: function reduce(callbackfn /* , initialValue */) {
|
|
13
13
|
var map = anObject(this);
|
|
14
14
|
var iterator = getMapIterator(map);
|
|
15
|
-
var
|
|
15
|
+
var noInitial = arguments.length < 2;
|
|
16
|
+
var accumulator = noInitial ? undefined : arguments[1];
|
|
16
17
|
aFunction(callbackfn);
|
|
17
|
-
if (arguments.length > 1) accumulator = arguments[1];
|
|
18
|
-
else {
|
|
19
|
-
step = iterator.next();
|
|
20
|
-
if (step.done) throw TypeError('Reduce of empty map with no initial value');
|
|
21
|
-
accumulator = step.value[1];
|
|
22
|
-
}
|
|
23
18
|
iterate(iterator, function (key, value) {
|
|
24
|
-
|
|
19
|
+
if (noInitial) {
|
|
20
|
+
noInitial = false;
|
|
21
|
+
accumulator = value;
|
|
22
|
+
} else {
|
|
23
|
+
accumulator = callbackfn(accumulator, value, key, map);
|
|
24
|
+
}
|
|
25
25
|
}, undefined, true, true);
|
|
26
|
+
if (noInitial) throw TypeError('Reduce of empty map with no initial value');
|
|
26
27
|
return accumulator;
|
|
27
28
|
}
|
|
28
29
|
});
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
// TODO: remove from `core-js@4`
|
|
2
3
|
var $ = require('../internals/export');
|
|
3
4
|
var IS_PURE = require('../internals/is-pure');
|
|
4
|
-
var
|
|
5
|
-
var aFunction = require('../internals/a-function');
|
|
5
|
+
var $upsert = require('../internals/map-upsert');
|
|
6
6
|
|
|
7
|
-
// `
|
|
8
|
-
// https://
|
|
7
|
+
// `Map.prototype.updateOrInsert` method (replaced by `Map.prototype.upsert`)
|
|
8
|
+
// https://github.com/thumbsupep/proposal-upsert
|
|
9
9
|
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
|
|
10
|
-
updateOrInsert:
|
|
11
|
-
var map = anObject(this);
|
|
12
|
-
aFunction(onUpdate);
|
|
13
|
-
aFunction(onInsert);
|
|
14
|
-
var value = map.has(key) ? onUpdate(map.get(key)) : onInsert();
|
|
15
|
-
map.set(key, value);
|
|
16
|
-
return value;
|
|
17
|
-
}
|
|
10
|
+
updateOrInsert: $upsert
|
|
18
11
|
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var $ = require('../internals/export');
|
|
3
|
+
var IS_PURE = require('../internals/is-pure');
|
|
4
|
+
var $upsert = require('../internals/map-upsert');
|
|
5
|
+
|
|
6
|
+
// `Map.prototype.upsert` method
|
|
7
|
+
// https://github.com/thumbsupep/proposal-upsert
|
|
8
|
+
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
|
|
9
|
+
upsert: $upsert
|
|
10
|
+
});
|
|
@@ -4,7 +4,6 @@ var $ = require('../internals/export');
|
|
|
4
4
|
// https://github.com/tc39/proposal-Math.signbit
|
|
5
5
|
$({ target: 'Math', stat: true }, {
|
|
6
6
|
signbit: function signbit(x) {
|
|
7
|
-
// eslint-disable-next-line no-self-compare
|
|
8
7
|
return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;
|
|
9
8
|
}
|
|
10
9
|
});
|
|
@@ -8,7 +8,7 @@ var anObject = require('../internals/an-object');
|
|
|
8
8
|
var isObject = require('../internals/is-object');
|
|
9
9
|
var anInstance = require('../internals/an-instance');
|
|
10
10
|
var defineProperty = require('../internals/object-define-property').f;
|
|
11
|
-
var
|
|
11
|
+
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
12
12
|
var redefineAll = require('../internals/redefine-all');
|
|
13
13
|
var getIterator = require('../internals/get-iterator');
|
|
14
14
|
var iterate = require('../internals/iterate');
|
|
@@ -198,7 +198,7 @@ redefineAll($Observable, {
|
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
createNonEnumerableProperty($Observable.prototype, OBSERVABLE, function () { return this; });
|
|
202
202
|
|
|
203
203
|
$({ global: true }, {
|
|
204
204
|
Observable: $Observable
|
|
@@ -12,17 +12,18 @@ $({ target: 'Set', proto: true, real: true, forced: IS_PURE }, {
|
|
|
12
12
|
reduce: function reduce(callbackfn /* , initialValue */) {
|
|
13
13
|
var set = anObject(this);
|
|
14
14
|
var iterator = getSetIterator(set);
|
|
15
|
-
var
|
|
15
|
+
var noInitial = arguments.length < 2;
|
|
16
|
+
var accumulator = noInitial ? undefined : arguments[1];
|
|
16
17
|
aFunction(callbackfn);
|
|
17
|
-
if (arguments.length > 1) accumulator = arguments[1];
|
|
18
|
-
else {
|
|
19
|
-
step = iterator.next();
|
|
20
|
-
if (step.done) throw TypeError('Reduce of empty set with no initial value');
|
|
21
|
-
accumulator = step.value;
|
|
22
|
-
}
|
|
23
18
|
iterate(iterator, function (value) {
|
|
24
|
-
|
|
19
|
+
if (noInitial) {
|
|
20
|
+
noInitial = false;
|
|
21
|
+
accumulator = value;
|
|
22
|
+
} else {
|
|
23
|
+
accumulator = callbackfn(accumulator, value, value, set);
|
|
24
|
+
}
|
|
25
25
|
}, undefined, false, true);
|
|
26
|
+
if (noInitial) throw TypeError('Reduce of empty set with no initial value');
|
|
26
27
|
return accumulator;
|
|
27
28
|
}
|
|
28
29
|
});
|
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
var $ = require('../internals/export');
|
|
3
|
-
var hide = require('../internals/hide');
|
|
4
3
|
var requireObjectCoercible = require('../internals/require-object-coercible');
|
|
5
|
-
var anObject = require('../internals/an-object');
|
|
6
4
|
var isRegExp = require('../internals/is-regexp');
|
|
7
5
|
var getRegExpFlags = require('../internals/regexp-flags');
|
|
8
|
-
var speciesConstructor = require('../internals/species-constructor');
|
|
9
6
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
10
7
|
var IS_PURE = require('../internals/is-pure');
|
|
11
8
|
|
|
12
|
-
var
|
|
9
|
+
var REPLACE = wellKnownSymbol('replace');
|
|
13
10
|
var RegExpPrototype = RegExp.prototype;
|
|
14
11
|
|
|
15
|
-
var $replaceAll = function (string, replaceValue) {
|
|
16
|
-
var rx = anObject(this);
|
|
17
|
-
var flags = String('flags' in RegExpPrototype ? rx.flags : getRegExpFlags.call(rx));
|
|
18
|
-
if (!~flags.indexOf('g')) {
|
|
19
|
-
rx = new (speciesConstructor(rx, RegExp))(rx.source, flags + 'g');
|
|
20
|
-
}
|
|
21
|
-
return String(string).replace(rx, replaceValue);
|
|
22
|
-
};
|
|
23
|
-
|
|
24
12
|
// `String.prototype.replaceAll` method
|
|
25
13
|
// https://github.com/tc39/proposal-string-replace-all
|
|
26
14
|
$({ target: 'String', proto: true }, {
|
|
27
15
|
replaceAll: function replaceAll(searchValue, replaceValue) {
|
|
28
16
|
var O = requireObjectCoercible(this);
|
|
29
|
-
var replacer, string, searchString, template, result, index;
|
|
17
|
+
var IS_REG_EXP, flags, replacer, string, searchString, template, result, index;
|
|
30
18
|
if (searchValue != null) {
|
|
31
|
-
|
|
19
|
+
IS_REG_EXP = isRegExp(searchValue);
|
|
20
|
+
if (IS_REG_EXP) {
|
|
21
|
+
flags = String(requireObjectCoercible('flags' in RegExpPrototype
|
|
22
|
+
? searchValue.flags
|
|
23
|
+
: getRegExpFlags.call(searchValue)
|
|
24
|
+
));
|
|
25
|
+
if (!~flags.indexOf('g')) throw TypeError('`.replaceAll` does not allow non-global regexes');
|
|
26
|
+
}
|
|
27
|
+
replacer = searchValue[REPLACE];
|
|
32
28
|
if (replacer !== undefined) {
|
|
33
29
|
return replacer.call(searchValue, O, replaceValue);
|
|
34
|
-
} else if (IS_PURE &&
|
|
35
|
-
return
|
|
30
|
+
} else if (IS_PURE && IS_REG_EXP) {
|
|
31
|
+
return String(O).replace(searchValue, replaceValue);
|
|
36
32
|
}
|
|
37
33
|
}
|
|
38
34
|
string = String(O);
|
|
@@ -49,5 +45,3 @@ $({ target: 'String', proto: true }, {
|
|
|
49
45
|
return result;
|
|
50
46
|
}
|
|
51
47
|
});
|
|
52
|
-
|
|
53
|
-
IS_PURE || REPLACE_ALL in RegExpPrototype || hide(RegExpPrototype, REPLACE_ALL, $replaceAll);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var $ = require('../internals/export');
|
|
3
|
+
var IS_PURE = require('../internals/is-pure');
|
|
4
|
+
var $upsert = require('../internals/map-upsert');
|
|
5
|
+
|
|
6
|
+
// `WeakMap.prototype.upsert` method
|
|
7
|
+
// https://github.com/thumbsupep/proposal-upsert
|
|
8
|
+
$({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, {
|
|
9
|
+
upsert: $upsert
|
|
10
|
+
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var global = require('../internals/global');
|
|
2
2
|
var DOMIterables = require('../internals/dom-iterables');
|
|
3
3
|
var forEach = require('../internals/array-for-each');
|
|
4
|
-
var
|
|
4
|
+
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
5
5
|
|
|
6
6
|
for (var COLLECTION_NAME in DOMIterables) {
|
|
7
7
|
var Collection = global[COLLECTION_NAME];
|
|
8
8
|
var CollectionPrototype = Collection && Collection.prototype;
|
|
9
9
|
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
10
10
|
if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
|
|
11
|
-
|
|
11
|
+
createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
|
|
12
12
|
} catch (error) {
|
|
13
13
|
CollectionPrototype.forEach = forEach;
|
|
14
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var global = require('../internals/global');
|
|
2
2
|
var DOMIterables = require('../internals/dom-iterables');
|
|
3
3
|
var ArrayIteratorMethods = require('../modules/es.array.iterator');
|
|
4
|
-
var
|
|
4
|
+
var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
|
|
5
5
|
var wellKnownSymbol = require('../internals/well-known-symbol');
|
|
6
6
|
|
|
7
7
|
var ITERATOR = wellKnownSymbol('iterator');
|
|
@@ -14,15 +14,17 @@ for (var COLLECTION_NAME in DOMIterables) {
|
|
|
14
14
|
if (CollectionPrototype) {
|
|
15
15
|
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
16
16
|
if (CollectionPrototype[ITERATOR] !== ArrayValues) try {
|
|
17
|
-
|
|
17
|
+
createNonEnumerableProperty(CollectionPrototype, ITERATOR, ArrayValues);
|
|
18
18
|
} catch (error) {
|
|
19
19
|
CollectionPrototype[ITERATOR] = ArrayValues;
|
|
20
20
|
}
|
|
21
|
-
if (!CollectionPrototype[TO_STRING_TAG])
|
|
21
|
+
if (!CollectionPrototype[TO_STRING_TAG]) {
|
|
22
|
+
createNonEnumerableProperty(CollectionPrototype, TO_STRING_TAG, COLLECTION_NAME);
|
|
23
|
+
}
|
|
22
24
|
if (DOMIterables[COLLECTION_NAME]) for (var METHOD_NAME in ArrayIteratorMethods) {
|
|
23
25
|
// some Chrome versions have non-configurable methods on DOMTokenList
|
|
24
26
|
if (CollectionPrototype[METHOD_NAME] !== ArrayIteratorMethods[METHOD_NAME]) try {
|
|
25
|
-
|
|
27
|
+
createNonEnumerableProperty(CollectionPrototype, METHOD_NAME, ArrayIteratorMethods[METHOD_NAME]);
|
|
26
28
|
} catch (error) {
|
|
27
29
|
CollectionPrototype[METHOD_NAME] = ArrayIteratorMethods[METHOD_NAME];
|
|
28
30
|
}
|
|
@@ -121,7 +121,7 @@ var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
|
|
|
121
121
|
var init = arguments.length > 0 ? arguments[0] : undefined;
|
|
122
122
|
var that = this;
|
|
123
123
|
var entries = [];
|
|
124
|
-
var iteratorMethod, iterator, step, entryIterator, first, second, key;
|
|
124
|
+
var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key;
|
|
125
125
|
|
|
126
126
|
setInternalState(that, {
|
|
127
127
|
type: URL_SEARCH_PARAMS,
|
|
@@ -135,12 +135,14 @@ var URLSearchParamsConstructor = function URLSearchParams(/* init */) {
|
|
|
135
135
|
iteratorMethod = getIteratorMethod(init);
|
|
136
136
|
if (typeof iteratorMethod === 'function') {
|
|
137
137
|
iterator = iteratorMethod.call(init);
|
|
138
|
-
|
|
138
|
+
next = iterator.next;
|
|
139
|
+
while (!(step = next.call(iterator)).done) {
|
|
139
140
|
entryIterator = getIterator(anObject(step.value));
|
|
141
|
+
entryNext = entryIterator.next;
|
|
140
142
|
if (
|
|
141
|
-
(first =
|
|
142
|
-
(second =
|
|
143
|
-
!
|
|
143
|
+
(first = entryNext.call(entryIterator)).done ||
|
|
144
|
+
(second = entryNext.call(entryIterator)).done ||
|
|
145
|
+
!entryNext.call(entryIterator).done
|
|
144
146
|
) throw TypeError('Expected sequence with length 2');
|
|
145
147
|
entries.push({ key: first.value + '', value: second.value + '' });
|
|
146
148
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-js",
|
|
3
3
|
"description": "Standard library",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/zloirock/core-js.git"
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"shim"
|
|
47
47
|
],
|
|
48
48
|
"scripts": {
|
|
49
|
-
"postinstall": "node
|
|
49
|
+
"postinstall": "node postinstall || echo \"ignore\""
|
|
50
50
|
}
|
|
51
51
|
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
var fs = require('fs');
|
|
3
|
+
var os = require('os');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var env = process.env;
|
|
6
|
+
|
|
7
|
+
var ADBLOCK = is(env.ADBLOCK);
|
|
8
|
+
var CI = is(env.CI);
|
|
9
|
+
var COLOR = is(env.npm_config_color);
|
|
10
|
+
var DISABLE_OPENCOLLECTIVE = is(env.DISABLE_OPENCOLLECTIVE);
|
|
11
|
+
var SILENT = ['silent', 'error', 'warn'].indexOf(env.npm_config_loglevel) !== -1;
|
|
12
|
+
var MINUTE = 60 * 1000;
|
|
13
|
+
|
|
14
|
+
var BANNER = '\u001B[96mThank you for using core-js (\u001B[94m https://github.com/zloirock/core-js \u001B[96m) for polyfilling JavaScript standard library!\u001B[0m\n\n' +
|
|
15
|
+
'\u001B[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: \u001B[0m\n' +
|
|
16
|
+
'\u001B[96m>\u001B[94m https://opencollective.com/core-js \u001B[0m\n' +
|
|
17
|
+
'\u001B[96m>\u001B[94m https://www.patreon.com/zloirock \u001B[0m\n\n' +
|
|
18
|
+
'\u001B[96mAlso, the author of core-js (\u001B[94m https://github.com/zloirock \u001B[96m) is looking for a good job -)\u001B[0m\n';
|
|
19
|
+
|
|
20
|
+
function is(it) {
|
|
21
|
+
return !!it && it !== '0' && it !== 'false';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function isBannerRequired() {
|
|
25
|
+
if (ADBLOCK || CI || DISABLE_OPENCOLLECTIVE || SILENT) return false;
|
|
26
|
+
var file = path.join(os.tmpdir(), 'core-js-banners');
|
|
27
|
+
var banners = [];
|
|
28
|
+
try {
|
|
29
|
+
var DELTA = Date.now() - fs.statSync(file).mtime;
|
|
30
|
+
if (DELTA >= 0 && DELTA < MINUTE * 3) {
|
|
31
|
+
banners = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
32
|
+
if (banners.indexOf(BANNER) !== -1) return false;
|
|
33
|
+
}
|
|
34
|
+
} catch (error) {
|
|
35
|
+
banners = [];
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
banners.push(BANNER);
|
|
39
|
+
fs.writeFileSync(file, JSON.stringify(banners), 'utf8');
|
|
40
|
+
} catch (error) { /* empty */ }
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function showBanner() {
|
|
45
|
+
// eslint-disable-next-line no-console,no-control-regex
|
|
46
|
+
console.log(COLOR ? BANNER : BANNER.replace(/\u001B\[\d+m/g, ''));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (isBannerRequired()) showBanner();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require('../modules/esnext.async-iterator.constructor');
|
|
2
|
+
require('../modules/esnext.async-iterator.drop');
|
|
3
|
+
require('../modules/esnext.async-iterator.filter');
|
|
4
|
+
require('../modules/esnext.async-iterator.from');
|
|
5
|
+
require('../modules/esnext.async-iterator.map');
|
|
6
|
+
require('../modules/esnext.async-iterator.take');
|
|
7
|
+
require('../modules/esnext.async-iterator.to-array');
|
|
8
|
+
require('../modules/esnext.iterator.constructor');
|
|
9
|
+
require('../modules/esnext.iterator.as-indexed-pairs');
|
|
10
|
+
require('../modules/esnext.iterator.drop');
|
|
11
|
+
require('../modules/esnext.iterator.every');
|
|
12
|
+
require('../modules/esnext.iterator.filter');
|
|
13
|
+
require('../modules/esnext.iterator.find');
|
|
14
|
+
require('../modules/esnext.iterator.for-each');
|
|
15
|
+
require('../modules/esnext.iterator.from');
|
|
16
|
+
require('../modules/esnext.iterator.map');
|
|
17
|
+
require('../modules/esnext.iterator.reduce');
|
|
18
|
+
require('../modules/esnext.iterator.some');
|
|
19
|
+
require('../modules/esnext.iterator.take');
|
|
20
|
+
require('../modules/esnext.iterator.to-array');
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
// TODO: remove from `core-js@4`
|
|
2
|
+
require('./map-upsert');
|
package/stable/global-this.js
CHANGED
package/stage/1.js
CHANGED
|
@@ -2,7 +2,6 @@ require('../proposals/array-last');
|
|
|
2
2
|
require('../proposals/collection-methods');
|
|
3
3
|
require('../proposals/collection-of-from');
|
|
4
4
|
require('../proposals/keys-composition');
|
|
5
|
-
require('../proposals/map-update-or-insert');
|
|
6
5
|
require('../proposals/math-extensions');
|
|
7
6
|
require('../proposals/math-signbit');
|
|
8
7
|
require('../proposals/number-from-string');
|
package/stage/2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require('../proposals/array-is-template-object');
|
|
2
|
-
require('../proposals/
|
|
2
|
+
require('../proposals/iterator-helpers');
|
|
3
|
+
require('../proposals/map-upsert');
|
|
3
4
|
require('../proposals/set-methods');
|
|
4
|
-
require('../proposals/string-replace-all');
|
|
5
5
|
require('../proposals/using-statement');
|
|
6
6
|
|
|
7
7
|
module.exports = require('./3');
|
package/stage/3.js
CHANGED
package/stage/4.js
CHANGED
package/LICENSE
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2014-2019 Denis Pushkarev
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in
|
|
11
|
-
all copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
-
THE SOFTWARE.
|
package/scripts/postinstall.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
var env = process.env;
|
|
3
|
-
var ADBLOCK = is(env.ADBLOCK);
|
|
4
|
-
var CI = is(env.CI);
|
|
5
|
-
var COLOR = is(env.npm_config_color);
|
|
6
|
-
var DISABLE_OPENCOLLECTIVE = is(env.DISABLE_OPENCOLLECTIVE);
|
|
7
|
-
var SILENT = !!~['silent', 'error', 'warn'].indexOf(env.npm_config_loglevel);
|
|
8
|
-
|
|
9
|
-
function is(it) {
|
|
10
|
-
return !!it && it !== '0' && it !== 'false';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function log(it) {
|
|
14
|
-
// eslint-disable-next-line no-console,no-control-regex
|
|
15
|
-
console.log(COLOR ? it : it.replace(/\u001B\[\d+m/g, ''));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
if (!ADBLOCK && !CI && !DISABLE_OPENCOLLECTIVE && !SILENT) {
|
|
19
|
-
log('\u001B[96mThank you for using core-js (\u001B[94m https://github.com/zloirock/core-js \u001B[96m) for polyfilling JavaScript standard library!\u001B[0m\n');
|
|
20
|
-
log('\u001B[96mThe project needs your help! Please consider supporting of core-js on Open Collective or Patreon: \u001B[0m');
|
|
21
|
-
log('\u001B[96m>\u001B[94m https://opencollective.com/core-js \u001B[0m');
|
|
22
|
-
log('\u001B[96m>\u001B[94m https://www.patreon.com/zloirock \u001B[0m\n');
|
|
23
|
-
log('\u001B[96mAlso, the author of core-js (\u001B[94m https://github.com/zloirock \u001B[96m) is looking for a good job -)\u001B[0m\n');
|
|
24
|
-
}
|