core-js 3.13.0 → 3.15.1
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/es/date/get-year.js +4 -0
- package/es/date/index.js +4 -1
- package/es/date/set-year.js +4 -0
- package/es/date/to-gmt-string.js +4 -0
- package/es/escape.js +4 -0
- package/es/index.js +7 -0
- package/es/regexp/dot-all.js +7 -0
- package/es/regexp/index.js +1 -0
- package/es/regexp/sticky.js +2 -0
- package/es/string/index.js +1 -0
- package/es/string/substr.js +4 -0
- package/es/string/virtual/index.js +1 -0
- package/es/string/virtual/substr.js +4 -0
- package/es/unescape.js +4 -0
- package/features/date/get-year.js +3 -0
- package/features/date/set-year.js +3 -0
- package/features/date/to-gmt-string.js +3 -0
- package/features/escape.js +3 -0
- package/features/index.js +7 -0
- package/features/regexp/dot-all.js +3 -0
- package/features/string/substr.js +3 -0
- package/features/string/virtual/substr.js +3 -0
- package/features/unescape.js +3 -0
- package/internals/array-sort.js +45 -0
- package/internals/call-with-safe-iteration-closing.js +0 -1
- package/internals/collection-strong.js +30 -14
- package/internals/collection-weak.js +12 -7
- package/internals/create-html.js +1 -1
- package/internals/date-to-primitive.js +2 -0
- package/internals/define-iterator.js +1 -1
- package/internals/engine-ff-version.js +5 -0
- package/internals/engine-is-ie-or-edge.js +3 -0
- package/internals/engine-webkit-version.js +5 -0
- package/internals/fix-regexp-well-known-symbol-logic.js +5 -62
- package/internals/get-substitution.js +1 -0
- package/internals/has.js +1 -1
- package/internals/inspect-source.js +1 -1
- package/internals/iterators-core.js +2 -1
- package/internals/native-symbol.js +4 -2
- package/internals/new-promise-capability.js +2 -1
- package/internals/object-prototype-accessors-forced.js +4 -0
- package/internals/regexp-exec.js +29 -5
- package/internals/regexp-sticky-helpers.js +3 -7
- package/internals/regexp-unsupported-dot-all.js +7 -0
- package/internals/regexp-unsupported-ncg.js +8 -0
- package/internals/shared.js +1 -1
- package/modules/es.array.sort.js +73 -4
- package/modules/es.date.get-year.js +12 -0
- package/modules/es.date.set-year.js +18 -0
- package/modules/es.date.to-gmt-string.js +7 -0
- package/modules/es.escape.js +35 -0
- package/modules/es.regexp.constructor.js +125 -24
- package/modules/es.regexp.dot-all.js +22 -0
- package/modules/es.regexp.flags.js +10 -8
- package/modules/es.regexp.sticky.js +1 -1
- package/modules/es.string.match.js +5 -5
- package/modules/es.string.replace.js +37 -10
- package/modules/es.string.search.js +5 -5
- package/modules/es.string.split.js +18 -6
- package/modules/es.string.substr.js +25 -0
- package/modules/es.typed-array.sort.js +77 -3
- package/modules/es.unescape.js +39 -0
- package/modules/web.url.js +3 -3
- package/package.json +2 -2
- package/stable/date/get-year.js +3 -0
- package/stable/date/set-year.js +3 -0
- package/stable/date/to-gmt-string.js +3 -0
- package/stable/escape.js +3 -0
- package/stable/index.js +7 -0
- package/stable/regexp/dot-all.js +3 -0
- package/stable/string/substr.js +3 -0
- package/stable/string/virtual/substr.js +3 -0
- package/stable/unescape.js +3 -0
package/es/date/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
require('../../modules/es.date.get-year');
|
|
1
2
|
require('../../modules/es.date.now');
|
|
2
|
-
require('../../modules/es.date.
|
|
3
|
+
require('../../modules/es.date.set-year');
|
|
4
|
+
require('../../modules/es.date.to-gmt-string');
|
|
3
5
|
require('../../modules/es.date.to-iso-string');
|
|
6
|
+
require('../../modules/es.date.to-json');
|
|
4
7
|
require('../../modules/es.date.to-string');
|
|
5
8
|
require('../../modules/es.date.to-primitive');
|
|
6
9
|
var path = require('../../internals/path');
|
package/es/escape.js
ADDED
package/es/index.js
CHANGED
|
@@ -47,11 +47,15 @@ require('../modules/es.array-buffer.constructor');
|
|
|
47
47
|
require('../modules/es.array-buffer.is-view');
|
|
48
48
|
require('../modules/es.array-buffer.slice');
|
|
49
49
|
require('../modules/es.data-view');
|
|
50
|
+
require('../modules/es.date.get-year');
|
|
50
51
|
require('../modules/es.date.now');
|
|
52
|
+
require('../modules/es.date.set-year');
|
|
53
|
+
require('../modules/es.date.to-gmt-string');
|
|
51
54
|
require('../modules/es.date.to-iso-string');
|
|
52
55
|
require('../modules/es.date.to-json');
|
|
53
56
|
require('../modules/es.date.to-primitive');
|
|
54
57
|
require('../modules/es.date.to-string');
|
|
58
|
+
require('../modules/es.escape');
|
|
55
59
|
require('../modules/es.function.bind');
|
|
56
60
|
require('../modules/es.function.has-instance');
|
|
57
61
|
require('../modules/es.function.name');
|
|
@@ -135,6 +139,7 @@ require('../modules/es.reflect.set');
|
|
|
135
139
|
require('../modules/es.reflect.set-prototype-of');
|
|
136
140
|
require('../modules/es.reflect.to-string-tag');
|
|
137
141
|
require('../modules/es.regexp.constructor');
|
|
142
|
+
require('../modules/es.regexp.dot-all');
|
|
138
143
|
require('../modules/es.regexp.exec');
|
|
139
144
|
require('../modules/es.regexp.flags');
|
|
140
145
|
require('../modules/es.regexp.sticky');
|
|
@@ -157,6 +162,7 @@ require('../modules/es.string.replace-all');
|
|
|
157
162
|
require('../modules/es.string.search');
|
|
158
163
|
require('../modules/es.string.split');
|
|
159
164
|
require('../modules/es.string.starts-with');
|
|
165
|
+
require('../modules/es.string.substr');
|
|
160
166
|
require('../modules/es.string.trim');
|
|
161
167
|
require('../modules/es.string.trim-end');
|
|
162
168
|
require('../modules/es.string.trim-start');
|
|
@@ -207,6 +213,7 @@ require('../modules/es.typed-array.sort');
|
|
|
207
213
|
require('../modules/es.typed-array.subarray');
|
|
208
214
|
require('../modules/es.typed-array.to-locale-string');
|
|
209
215
|
require('../modules/es.typed-array.to-string');
|
|
216
|
+
require('../modules/es.unescape');
|
|
210
217
|
require('../modules/es.weak-map');
|
|
211
218
|
require('../modules/es.weak-set');
|
|
212
219
|
|
package/es/regexp/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require('../../modules/es.regexp.constructor');
|
|
2
2
|
require('../../modules/es.regexp.to-string');
|
|
3
|
+
require('../../modules/es.regexp.dot-all');
|
|
3
4
|
require('../../modules/es.regexp.exec');
|
|
4
5
|
require('../../modules/es.regexp.flags');
|
|
5
6
|
require('../../modules/es.regexp.sticky');
|
package/es/regexp/sticky.js
CHANGED
package/es/string/index.js
CHANGED
|
@@ -14,6 +14,7 @@ require('../../modules/es.string.replace-all');
|
|
|
14
14
|
require('../../modules/es.string.search');
|
|
15
15
|
require('../../modules/es.string.split');
|
|
16
16
|
require('../../modules/es.string.starts-with');
|
|
17
|
+
require('../../modules/es.string.substr');
|
|
17
18
|
require('../../modules/es.string.trim');
|
|
18
19
|
require('../../modules/es.string.trim-start');
|
|
19
20
|
require('../../modules/es.string.trim-end');
|
|
@@ -11,6 +11,7 @@ require('../../../modules/es.string.replace-all');
|
|
|
11
11
|
require('../../../modules/es.string.search');
|
|
12
12
|
require('../../../modules/es.string.split');
|
|
13
13
|
require('../../../modules/es.string.starts-with');
|
|
14
|
+
require('../../../modules/es.string.substr');
|
|
14
15
|
require('../../../modules/es.string.trim');
|
|
15
16
|
require('../../../modules/es.string.trim-start');
|
|
16
17
|
require('../../../modules/es.string.trim-end');
|
package/es/unescape.js
ADDED
package/features/index.js
CHANGED
|
@@ -47,11 +47,15 @@ require('../modules/es.array-buffer.constructor');
|
|
|
47
47
|
require('../modules/es.array-buffer.is-view');
|
|
48
48
|
require('../modules/es.array-buffer.slice');
|
|
49
49
|
require('../modules/es.data-view');
|
|
50
|
+
require('../modules/es.date.get-year');
|
|
50
51
|
require('../modules/es.date.now');
|
|
52
|
+
require('../modules/es.date.set-year');
|
|
53
|
+
require('../modules/es.date.to-gmt-string');
|
|
51
54
|
require('../modules/es.date.to-iso-string');
|
|
52
55
|
require('../modules/es.date.to-json');
|
|
53
56
|
require('../modules/es.date.to-primitive');
|
|
54
57
|
require('../modules/es.date.to-string');
|
|
58
|
+
require('../modules/es.escape');
|
|
55
59
|
require('../modules/es.function.bind');
|
|
56
60
|
require('../modules/es.function.has-instance');
|
|
57
61
|
require('../modules/es.function.name');
|
|
@@ -135,6 +139,7 @@ require('../modules/es.reflect.set');
|
|
|
135
139
|
require('../modules/es.reflect.set-prototype-of');
|
|
136
140
|
require('../modules/es.reflect.to-string-tag');
|
|
137
141
|
require('../modules/es.regexp.constructor');
|
|
142
|
+
require('../modules/es.regexp.dot-all');
|
|
138
143
|
require('../modules/es.regexp.exec');
|
|
139
144
|
require('../modules/es.regexp.flags');
|
|
140
145
|
require('../modules/es.regexp.sticky');
|
|
@@ -157,6 +162,7 @@ require('../modules/es.string.replace-all');
|
|
|
157
162
|
require('../modules/es.string.search');
|
|
158
163
|
require('../modules/es.string.split');
|
|
159
164
|
require('../modules/es.string.starts-with');
|
|
165
|
+
require('../modules/es.string.substr');
|
|
160
166
|
require('../modules/es.string.trim');
|
|
161
167
|
require('../modules/es.string.trim-end');
|
|
162
168
|
require('../modules/es.string.trim-start');
|
|
@@ -207,6 +213,7 @@ require('../modules/es.typed-array.sort');
|
|
|
207
213
|
require('../modules/es.typed-array.subarray');
|
|
208
214
|
require('../modules/es.typed-array.to-locale-string');
|
|
209
215
|
require('../modules/es.typed-array.to-string');
|
|
216
|
+
require('../modules/es.unescape');
|
|
210
217
|
require('../modules/es.weak-map');
|
|
211
218
|
require('../modules/es.weak-set');
|
|
212
219
|
require('../modules/esnext.aggregate-error');
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// TODO: use something more complex like timsort?
|
|
2
|
+
var floor = Math.floor;
|
|
3
|
+
|
|
4
|
+
var mergeSort = function (array, comparefn) {
|
|
5
|
+
var length = array.length;
|
|
6
|
+
var middle = floor(length / 2);
|
|
7
|
+
return length < 8 ? insertionSort(array, comparefn) : merge(
|
|
8
|
+
mergeSort(array.slice(0, middle), comparefn),
|
|
9
|
+
mergeSort(array.slice(middle), comparefn),
|
|
10
|
+
comparefn
|
|
11
|
+
);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var insertionSort = function (array, comparefn) {
|
|
15
|
+
var length = array.length;
|
|
16
|
+
var i = 1;
|
|
17
|
+
var element, j;
|
|
18
|
+
|
|
19
|
+
while (i < length) {
|
|
20
|
+
j = i;
|
|
21
|
+
element = array[i];
|
|
22
|
+
while (j && comparefn(array[j - 1], element) > 0) {
|
|
23
|
+
array[j] = array[--j];
|
|
24
|
+
}
|
|
25
|
+
if (j !== i++) array[j] = element;
|
|
26
|
+
} return array;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var merge = function (left, right, comparefn) {
|
|
30
|
+
var llength = left.length;
|
|
31
|
+
var rlength = right.length;
|
|
32
|
+
var lindex = 0;
|
|
33
|
+
var rindex = 0;
|
|
34
|
+
var result = [];
|
|
35
|
+
|
|
36
|
+
while (lindex < llength || rindex < rlength) {
|
|
37
|
+
if (lindex < llength && rindex < rlength) {
|
|
38
|
+
result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]);
|
|
39
|
+
} else {
|
|
40
|
+
result.push(lindex < llength ? left[lindex++] : right[rindex++]);
|
|
41
|
+
}
|
|
42
|
+
} return result;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
module.exports = mergeSort;
|
|
@@ -5,7 +5,6 @@ var iteratorClose = require('../internals/iterator-close');
|
|
|
5
5
|
module.exports = function (iterator, fn, value, ENTRIES) {
|
|
6
6
|
try {
|
|
7
7
|
return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
|
|
8
|
-
// 7.4.6 IteratorClose(iterator, completion)
|
|
9
8
|
} catch (error) {
|
|
10
9
|
iteratorClose(iterator);
|
|
11
10
|
throw error;
|
|
@@ -70,8 +70,9 @@ module.exports = {
|
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
redefineAll(C.prototype, {
|
|
73
|
-
//
|
|
74
|
-
//
|
|
73
|
+
// `{ Map, Set }.prototype.clear()` methods
|
|
74
|
+
// https://tc39.es/ecma262/#sec-map.prototype.clear
|
|
75
|
+
// https://tc39.es/ecma262/#sec-set.prototype.clear
|
|
75
76
|
clear: function clear() {
|
|
76
77
|
var that = this;
|
|
77
78
|
var state = getInternalState(that);
|
|
@@ -87,8 +88,9 @@ module.exports = {
|
|
|
87
88
|
if (DESCRIPTORS) state.size = 0;
|
|
88
89
|
else that.size = 0;
|
|
89
90
|
},
|
|
90
|
-
//
|
|
91
|
-
//
|
|
91
|
+
// `{ Map, Set }.prototype.delete(key)` methods
|
|
92
|
+
// https://tc39.es/ecma262/#sec-map.prototype.delete
|
|
93
|
+
// https://tc39.es/ecma262/#sec-set.prototype.delete
|
|
92
94
|
'delete': function (key) {
|
|
93
95
|
var that = this;
|
|
94
96
|
var state = getInternalState(that);
|
|
@@ -106,8 +108,9 @@ module.exports = {
|
|
|
106
108
|
else that.size--;
|
|
107
109
|
} return !!entry;
|
|
108
110
|
},
|
|
109
|
-
//
|
|
110
|
-
//
|
|
111
|
+
// `{ Map, Set }.prototype.forEach(callbackfn, thisArg = undefined)` methods
|
|
112
|
+
// https://tc39.es/ecma262/#sec-map.prototype.foreach
|
|
113
|
+
// https://tc39.es/ecma262/#sec-set.prototype.foreach
|
|
111
114
|
forEach: function forEach(callbackfn /* , that = undefined */) {
|
|
112
115
|
var state = getInternalState(this);
|
|
113
116
|
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
|
|
@@ -118,25 +121,29 @@ module.exports = {
|
|
|
118
121
|
while (entry && entry.removed) entry = entry.previous;
|
|
119
122
|
}
|
|
120
123
|
},
|
|
121
|
-
//
|
|
122
|
-
//
|
|
124
|
+
// `{ Map, Set}.prototype.has(key)` methods
|
|
125
|
+
// https://tc39.es/ecma262/#sec-map.prototype.has
|
|
126
|
+
// https://tc39.es/ecma262/#sec-set.prototype.has
|
|
123
127
|
has: function has(key) {
|
|
124
128
|
return !!getEntry(this, key);
|
|
125
129
|
}
|
|
126
130
|
});
|
|
127
131
|
|
|
128
132
|
redefineAll(C.prototype, IS_MAP ? {
|
|
129
|
-
//
|
|
133
|
+
// `Map.prototype.get(key)` method
|
|
134
|
+
// https://tc39.es/ecma262/#sec-map.prototype.get
|
|
130
135
|
get: function get(key) {
|
|
131
136
|
var entry = getEntry(this, key);
|
|
132
137
|
return entry && entry.value;
|
|
133
138
|
},
|
|
134
|
-
//
|
|
139
|
+
// `Map.prototype.set(key, value)` method
|
|
140
|
+
// https://tc39.es/ecma262/#sec-map.prototype.set
|
|
135
141
|
set: function set(key, value) {
|
|
136
142
|
return define(this, key === 0 ? 0 : key, value);
|
|
137
143
|
}
|
|
138
144
|
} : {
|
|
139
|
-
//
|
|
145
|
+
// `Set.prototype.add(value)` method
|
|
146
|
+
// https://tc39.es/ecma262/#sec-set.prototype.add
|
|
140
147
|
add: function add(value) {
|
|
141
148
|
return define(this, value = value === 0 ? 0 : value, value);
|
|
142
149
|
}
|
|
@@ -152,8 +159,15 @@ module.exports = {
|
|
|
152
159
|
var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator';
|
|
153
160
|
var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME);
|
|
154
161
|
var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME);
|
|
155
|
-
//
|
|
156
|
-
//
|
|
162
|
+
// `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods
|
|
163
|
+
// https://tc39.es/ecma262/#sec-map.prototype.entries
|
|
164
|
+
// https://tc39.es/ecma262/#sec-map.prototype.keys
|
|
165
|
+
// https://tc39.es/ecma262/#sec-map.prototype.values
|
|
166
|
+
// https://tc39.es/ecma262/#sec-map.prototype-@@iterator
|
|
167
|
+
// https://tc39.es/ecma262/#sec-set.prototype.entries
|
|
168
|
+
// https://tc39.es/ecma262/#sec-set.prototype.keys
|
|
169
|
+
// https://tc39.es/ecma262/#sec-set.prototype.values
|
|
170
|
+
// https://tc39.es/ecma262/#sec-set.prototype-@@iterator
|
|
157
171
|
defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) {
|
|
158
172
|
setInternalState(this, {
|
|
159
173
|
type: ITERATOR_NAME,
|
|
@@ -180,7 +194,9 @@ module.exports = {
|
|
|
180
194
|
return { value: [entry.key, entry.value], done: false };
|
|
181
195
|
}, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
|
|
182
196
|
|
|
183
|
-
//
|
|
197
|
+
// `{ Map, Set }.prototype[@@species]` accessors
|
|
198
|
+
// https://tc39.es/ecma262/#sec-get-map-@@species
|
|
199
|
+
// https://tc39.es/ecma262/#sec-get-set-@@species
|
|
184
200
|
setSpecies(CONSTRUCTOR_NAME);
|
|
185
201
|
}
|
|
186
202
|
};
|
|
@@ -75,8 +75,9 @@ module.exports = {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
redefineAll(C.prototype, {
|
|
78
|
-
//
|
|
79
|
-
//
|
|
78
|
+
// `{ WeakMap, WeakSet }.prototype.delete(key)` methods
|
|
79
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.delete
|
|
80
|
+
// https://tc39.es/ecma262/#sec-weakset.prototype.delete
|
|
80
81
|
'delete': function (key) {
|
|
81
82
|
var state = getInternalState(this);
|
|
82
83
|
if (!isObject(key)) return false;
|
|
@@ -84,8 +85,9 @@ module.exports = {
|
|
|
84
85
|
if (data === true) return uncaughtFrozenStore(state)['delete'](key);
|
|
85
86
|
return data && $has(data, state.id) && delete data[state.id];
|
|
86
87
|
},
|
|
87
|
-
//
|
|
88
|
-
//
|
|
88
|
+
// `{ WeakMap, WeakSet }.prototype.has(key)` methods
|
|
89
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.has
|
|
90
|
+
// https://tc39.es/ecma262/#sec-weakset.prototype.has
|
|
89
91
|
has: function has(key) {
|
|
90
92
|
var state = getInternalState(this);
|
|
91
93
|
if (!isObject(key)) return false;
|
|
@@ -96,7 +98,8 @@ module.exports = {
|
|
|
96
98
|
});
|
|
97
99
|
|
|
98
100
|
redefineAll(C.prototype, IS_MAP ? {
|
|
99
|
-
//
|
|
101
|
+
// `WeakMap.prototype.get(key)` method
|
|
102
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.get
|
|
100
103
|
get: function get(key) {
|
|
101
104
|
var state = getInternalState(this);
|
|
102
105
|
if (isObject(key)) {
|
|
@@ -105,12 +108,14 @@ module.exports = {
|
|
|
105
108
|
return data ? data[state.id] : undefined;
|
|
106
109
|
}
|
|
107
110
|
},
|
|
108
|
-
//
|
|
111
|
+
// `WeakMap.prototype.set(key, value)` method
|
|
112
|
+
// https://tc39.es/ecma262/#sec-weakmap.prototype.set
|
|
109
113
|
set: function set(key, value) {
|
|
110
114
|
return define(this, key, value);
|
|
111
115
|
}
|
|
112
116
|
} : {
|
|
113
|
-
//
|
|
117
|
+
// `WeakSet.prototype.add(value)` method
|
|
118
|
+
// https://tc39.es/ecma262/#sec-weakset.prototype.add
|
|
114
119
|
add: function add(value) {
|
|
115
120
|
return define(this, value, true);
|
|
116
121
|
}
|
package/internals/create-html.js
CHANGED
|
@@ -2,7 +2,7 @@ var requireObjectCoercible = require('../internals/require-object-coercible');
|
|
|
2
2
|
|
|
3
3
|
var quot = /"/g;
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// `CreateHTML` abstract operation
|
|
6
6
|
// https://tc39.es/ecma262/#sec-createhtml
|
|
7
7
|
module.exports = function (string, tag, attribute, value) {
|
|
8
8
|
var S = String(requireObjectCoercible(string));
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
var anObject = require('../internals/an-object');
|
|
3
3
|
var toPrimitive = require('../internals/to-primitive');
|
|
4
4
|
|
|
5
|
+
// `Date.prototype[@@toPrimitive](hint)` method implementation
|
|
6
|
+
// https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive
|
|
5
7
|
module.exports = function (hint) {
|
|
6
8
|
if (hint !== 'string' && hint !== 'number' && hint !== 'default') {
|
|
7
9
|
throw TypeError('Incorrect hint');
|
|
@@ -60,7 +60,7 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
// fix Array
|
|
63
|
+
// fix Array.prototype.{ values, @@iterator }.name in V8 / FF
|
|
64
64
|
if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
|
65
65
|
INCORRECT_VALUES_NAME = true;
|
|
66
66
|
defaultIterator = function values() { return nativeIterator.call(this); };
|
|
@@ -10,47 +10,7 @@ var createNonEnumerableProperty = require('../internals/create-non-enumerable-pr
|
|
|
10
10
|
var SPECIES = wellKnownSymbol('species');
|
|
11
11
|
var RegExpPrototype = RegExp.prototype;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
// #replace needs built-in support for named groups.
|
|
15
|
-
// #match works fine because it just return the exec results, even if it has
|
|
16
|
-
// a "grops" property.
|
|
17
|
-
var re = /./;
|
|
18
|
-
re.exec = function () {
|
|
19
|
-
var result = [];
|
|
20
|
-
result.groups = { a: '7' };
|
|
21
|
-
return result;
|
|
22
|
-
};
|
|
23
|
-
return ''.replace(re, '$<a>') !== '7';
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
// IE <= 11 replaces $0 with the whole match, as if it was $&
|
|
27
|
-
// https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
|
|
28
|
-
var REPLACE_KEEPS_$0 = (function () {
|
|
29
|
-
// eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
|
|
30
|
-
return 'a'.replace(/./, '$0') === '$0';
|
|
31
|
-
})();
|
|
32
|
-
|
|
33
|
-
var REPLACE = wellKnownSymbol('replace');
|
|
34
|
-
// Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
|
|
35
|
-
var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
|
|
36
|
-
if (/./[REPLACE]) {
|
|
37
|
-
return /./[REPLACE]('a', '$0') === '';
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
})();
|
|
41
|
-
|
|
42
|
-
// Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
|
|
43
|
-
// Weex JS has frozen built-in prototypes, so use try / catch wrapper
|
|
44
|
-
var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () {
|
|
45
|
-
// eslint-disable-next-line regexp/no-empty-group -- required for testing
|
|
46
|
-
var re = /(?:)/;
|
|
47
|
-
var originalExec = re.exec;
|
|
48
|
-
re.exec = function () { return originalExec.apply(this, arguments); };
|
|
49
|
-
var result = 'ab'.split(re);
|
|
50
|
-
return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b';
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
module.exports = function (KEY, length, exec, sham) {
|
|
13
|
+
module.exports = function (KEY, exec, FORCED, SHAM) {
|
|
54
14
|
var SYMBOL = wellKnownSymbol(KEY);
|
|
55
15
|
|
|
56
16
|
var DELEGATES_TO_SYMBOL = !fails(function () {
|
|
@@ -87,12 +47,7 @@ module.exports = function (KEY, length, exec, sham) {
|
|
|
87
47
|
if (
|
|
88
48
|
!DELEGATES_TO_SYMBOL ||
|
|
89
49
|
!DELEGATES_TO_EXEC ||
|
|
90
|
-
|
|
91
|
-
REPLACE_SUPPORTS_NAMED_GROUPS &&
|
|
92
|
-
REPLACE_KEEPS_$0 &&
|
|
93
|
-
!REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
|
|
94
|
-
)) ||
|
|
95
|
-
(KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)
|
|
50
|
+
FORCED
|
|
96
51
|
) {
|
|
97
52
|
var nativeRegExpMethod = /./[SYMBOL];
|
|
98
53
|
var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) {
|
|
@@ -107,23 +62,11 @@ module.exports = function (KEY, length, exec, sham) {
|
|
|
107
62
|
return { done: true, value: nativeMethod.call(str, regexp, arg2) };
|
|
108
63
|
}
|
|
109
64
|
return { done: false };
|
|
110
|
-
}, {
|
|
111
|
-
REPLACE_KEEPS_$0: REPLACE_KEEPS_$0,
|
|
112
|
-
REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE: REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE
|
|
113
65
|
});
|
|
114
|
-
var stringMethod = methods[0];
|
|
115
|
-
var regexMethod = methods[1];
|
|
116
66
|
|
|
117
|
-
redefine(String.prototype, KEY,
|
|
118
|
-
redefine(RegExpPrototype, SYMBOL,
|
|
119
|
-
// 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
|
|
120
|
-
// 21.2.5.11 RegExp.prototype[@@split](string, limit)
|
|
121
|
-
? function (string, arg) { return regexMethod.call(string, this, arg); }
|
|
122
|
-
// 21.2.5.6 RegExp.prototype[@@match](string)
|
|
123
|
-
// 21.2.5.9 RegExp.prototype[@@search](string)
|
|
124
|
-
: function (string) { return regexMethod.call(string, this); }
|
|
125
|
-
);
|
|
67
|
+
redefine(String.prototype, KEY, methods[0]);
|
|
68
|
+
redefine(RegExpPrototype, SYMBOL, methods[1]);
|
|
126
69
|
}
|
|
127
70
|
|
|
128
|
-
if (
|
|
71
|
+
if (SHAM) createNonEnumerableProperty(RegExpPrototype[SYMBOL], 'sham', true);
|
|
129
72
|
};
|
|
@@ -5,6 +5,7 @@ var replace = ''.replace;
|
|
|
5
5
|
var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g;
|
|
6
6
|
var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g;
|
|
7
7
|
|
|
8
|
+
// `GetSubstitution` abstract operation
|
|
8
9
|
// https://tc39.es/ecma262/#sec-getsubstitution
|
|
9
10
|
module.exports = function (matched, str, position, captures, namedCaptures, replacement) {
|
|
10
11
|
var tailPos = position + matched.length;
|
package/internals/has.js
CHANGED
|
@@ -2,7 +2,7 @@ var store = require('../internals/shared-store');
|
|
|
2
2
|
|
|
3
3
|
var functionToString = Function.toString;
|
|
4
4
|
|
|
5
|
-
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
|
|
5
|
+
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
6
6
|
if (typeof store.inspectSource != 'function') {
|
|
7
7
|
store.inspectSource = function (it) {
|
|
8
8
|
return functionToString.call(it);
|
|
@@ -34,7 +34,8 @@ var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function ()
|
|
|
34
34
|
|
|
35
35
|
if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// `%IteratorPrototype%[@@iterator]()` method
|
|
38
|
+
// https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator
|
|
38
39
|
if ((!IS_PURE || NEW_ITERATOR_PROTOTYPE) && !has(IteratorPrototype, ITERATOR)) {
|
|
39
40
|
createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis);
|
|
40
41
|
}
|
|
@@ -4,8 +4,10 @@ var fails = require('../internals/fails');
|
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
6
6
|
module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
var symbol = Symbol();
|
|
8
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
9
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
10
|
+
return !String(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
9
11
|
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
10
12
|
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
11
13
|
});
|
|
@@ -12,7 +12,8 @@ var PromiseCapability = function (C) {
|
|
|
12
12
|
this.reject = aFunction(reject);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
//
|
|
15
|
+
// `NewPromiseCapability` abstract operation
|
|
16
|
+
// https://tc39.es/ecma262/#sec-newpromisecapability
|
|
16
17
|
module.exports.f = function (C) {
|
|
17
18
|
return new PromiseCapability(C);
|
|
18
19
|
};
|