core-js 3.46.0 → 3.48.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/LICENSE +2 -1
- package/actual/iterator/concat.js +2 -18
- package/actual/iterator/index.js +3 -0
- package/actual/iterator/zip-keyed.js +24 -0
- package/actual/iterator/zip.js +22 -0
- package/actual/json/index.js +0 -3
- package/actual/json/is-raw-json.js +2 -2
- package/actual/json/parse.js +2 -3
- package/actual/json/raw-json.js +3 -4
- package/actual/map/get-or-insert-computed.js +2 -3
- package/actual/map/get-or-insert.js +2 -3
- package/actual/map/group-by.js +2 -0
- package/actual/weak-map/get-or-insert-computed.js +2 -3
- package/actual/weak-map/get-or-insert.js +2 -3
- package/es/index.js +8 -0
- package/es/iterator/concat.js +21 -0
- package/es/iterator/index.js +1 -0
- package/es/json/index.js +6 -0
- package/es/json/is-raw-json.js +5 -0
- package/es/json/parse.js +6 -0
- package/es/json/raw-json.js +7 -0
- package/es/map/get-or-insert-computed.js +6 -0
- package/es/map/get-or-insert.js +6 -0
- package/es/map/group-by.js +2 -0
- package/es/map/index.js +2 -0
- package/es/weak-map/get-or-insert-computed.js +6 -0
- package/es/weak-map/get-or-insert.js +6 -0
- package/es/weak-map/index.js +2 -0
- package/full/index.js +8 -0
- package/full/iterator/index.js +1 -3
- package/full/iterator/zip-keyed.js +2 -22
- package/full/iterator/zip.js +2 -20
- package/internals/array-from.js +2 -1
- package/internals/array-iteration.js +11 -13
- package/internals/array-unique-by.js +3 -3
- package/internals/async-iterator-iteration.js +5 -3
- package/internals/check-correctness-of-iteration.js +2 -0
- package/internals/fix-regexp-well-known-symbol-logic.js +6 -4
- package/internals/flatten-into-array.js +2 -1
- package/internals/internal-metadata.js +1 -0
- package/internals/native-raw-json.js +2 -2
- package/internals/set-method-accept-set-like.js +1 -3
- package/internals/shared-store.js +3 -3
- package/internals/to-string-tag-support.js +1 -1
- package/modules/es.array.concat.js +2 -1
- package/modules/es.array.flat-map.js +1 -1
- package/modules/es.array.flat.js +1 -1
- package/modules/es.array.of.js +2 -1
- package/modules/es.array.slice.js +2 -1
- package/modules/es.array.splice.js +1 -1
- package/modules/es.array.to-reversed.js +8 -2
- package/modules/es.array.to-spliced.js +4 -3
- package/modules/es.array.with.js +13 -2
- package/modules/es.error.cause.js +2 -0
- package/modules/es.iterator.concat.js +56 -0
- package/modules/es.iterator.flat-map.js +15 -1
- package/modules/es.iterator.to-array.js +5 -3
- package/modules/es.json.is-raw-json.js +11 -0
- package/modules/es.json.parse.js +251 -0
- package/modules/es.json.raw-json.js +39 -0
- package/modules/es.json.stringify.js +78 -19
- package/modules/es.map.get-or-insert-computed.js +25 -0
- package/modules/es.map.get-or-insert.js +19 -0
- package/modules/es.regexp.constructor.js +2 -2
- package/modules/es.typed-array.map.js +3 -4
- package/modules/es.typed-array.to-reversed.js +7 -2
- package/modules/es.typed-array.with.js +11 -3
- package/modules/es.uint8-array.set-from-hex.js +14 -1
- package/modules/es.weak-map.get-or-insert-computed.js +36 -0
- package/modules/es.weak-map.get-or-insert.js +19 -0
- package/modules/esnext.iterator.concat.js +2 -55
- package/modules/esnext.iterator.zip-keyed.js +1 -1
- package/modules/esnext.iterator.zip.js +1 -1
- package/modules/esnext.json.is-raw-json.js +2 -10
- package/modules/esnext.json.parse.js +2 -250
- package/modules/esnext.json.raw-json.js +2 -85
- package/modules/esnext.map.get-or-insert-computed.js +2 -24
- package/modules/esnext.map.get-or-insert.js +2 -18
- package/modules/esnext.weak-map.get-or-insert-computed.js +2 -35
- package/modules/esnext.weak-map.get-or-insert.js +2 -18
- package/modules/web.url-search-params.constructor.js +1 -1
- package/package.json +2 -1
- package/stable/index.js +8 -0
- package/stable/iterator/concat.js +5 -0
- package/stable/json/is-raw-json.js +4 -0
- package/stable/json/parse.js +4 -0
- package/stable/json/raw-json.js +4 -0
- package/stable/map/get-or-insert-computed.js +4 -0
- package/stable/map/get-or-insert.js +4 -0
- package/stable/weak-map/get-or-insert-computed.js +4 -0
- package/stable/weak-map/get-or-insert.js +4 -0
- package/stage/2.7.js +0 -1
- package/stage/3.js +1 -3
- package/stage/4.js +3 -0
- package/internals/array-to-reversed.js +0 -12
- package/internals/array-with.js +0 -18
- package/internals/get-json-replacer-function.js +0 -30
|
@@ -1,251 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var globalThis = require('../internals/global-this');
|
|
5
|
-
var getBuiltIn = require('../internals/get-built-in');
|
|
6
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
7
|
-
var call = require('../internals/function-call');
|
|
8
|
-
var isCallable = require('../internals/is-callable');
|
|
9
|
-
var isObject = require('../internals/is-object');
|
|
10
|
-
var isArray = require('../internals/is-array');
|
|
11
|
-
var hasOwn = require('../internals/has-own-property');
|
|
12
|
-
var toString = require('../internals/to-string');
|
|
13
|
-
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
|
14
|
-
var createProperty = require('../internals/create-property');
|
|
15
|
-
var fails = require('../internals/fails');
|
|
16
|
-
var parseJSONString = require('../internals/parse-json-string');
|
|
17
|
-
var NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');
|
|
18
|
-
|
|
19
|
-
var JSON = globalThis.JSON;
|
|
20
|
-
var Number = globalThis.Number;
|
|
21
|
-
var SyntaxError = globalThis.SyntaxError;
|
|
22
|
-
var nativeParse = JSON && JSON.parse;
|
|
23
|
-
var enumerableOwnProperties = getBuiltIn('Object', 'keys');
|
|
24
|
-
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
25
|
-
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
26
|
-
var at = uncurryThis(''.charAt);
|
|
27
|
-
var slice = uncurryThis(''.slice);
|
|
28
|
-
var exec = uncurryThis(/./.exec);
|
|
29
|
-
var push = uncurryThis([].push);
|
|
30
|
-
|
|
31
|
-
var IS_DIGIT = /^\d$/;
|
|
32
|
-
var IS_NON_ZERO_DIGIT = /^[1-9]$/;
|
|
33
|
-
var IS_NUMBER_START = /^[\d-]$/;
|
|
34
|
-
var IS_WHITESPACE = /^[\t\n\r ]$/;
|
|
35
|
-
|
|
36
|
-
var PRIMITIVE = 0;
|
|
37
|
-
var OBJECT = 1;
|
|
38
|
-
|
|
39
|
-
var $parse = function (source, reviver) {
|
|
40
|
-
source = toString(source);
|
|
41
|
-
var context = new Context(source, 0, '');
|
|
42
|
-
var root = context.parse();
|
|
43
|
-
var value = root.value;
|
|
44
|
-
var endIndex = context.skip(IS_WHITESPACE, root.end);
|
|
45
|
-
if (endIndex < source.length) {
|
|
46
|
-
throw new SyntaxError('Unexpected extra character: "' + at(source, endIndex) + '" after the parsed data at: ' + endIndex);
|
|
47
|
-
}
|
|
48
|
-
return isCallable(reviver) ? internalize({ '': value }, '', reviver, root) : value;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var internalize = function (holder, name, reviver, node) {
|
|
52
|
-
var val = holder[name];
|
|
53
|
-
var unmodified = node && val === node.value;
|
|
54
|
-
var context = unmodified && typeof node.source == 'string' ? { source: node.source } : {};
|
|
55
|
-
var elementRecordsLen, keys, len, i, P;
|
|
56
|
-
if (isObject(val)) {
|
|
57
|
-
var nodeIsArray = isArray(val);
|
|
58
|
-
var nodes = unmodified ? node.nodes : nodeIsArray ? [] : {};
|
|
59
|
-
if (nodeIsArray) {
|
|
60
|
-
elementRecordsLen = nodes.length;
|
|
61
|
-
len = lengthOfArrayLike(val);
|
|
62
|
-
for (i = 0; i < len; i++) {
|
|
63
|
-
internalizeProperty(val, i, internalize(val, '' + i, reviver, i < elementRecordsLen ? nodes[i] : undefined));
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
keys = enumerableOwnProperties(val);
|
|
67
|
-
len = lengthOfArrayLike(keys);
|
|
68
|
-
for (i = 0; i < len; i++) {
|
|
69
|
-
P = keys[i];
|
|
70
|
-
internalizeProperty(val, P, internalize(val, P, reviver, hasOwn(nodes, P) ? nodes[P] : undefined));
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return call(reviver, holder, name, val, context);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
var internalizeProperty = function (object, key, value) {
|
|
78
|
-
if (DESCRIPTORS) {
|
|
79
|
-
var descriptor = getOwnPropertyDescriptor(object, key);
|
|
80
|
-
if (descriptor && !descriptor.configurable) return;
|
|
81
|
-
}
|
|
82
|
-
if (value === undefined) delete object[key];
|
|
83
|
-
else createProperty(object, key, value);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
var Node = function (value, end, source, nodes) {
|
|
87
|
-
this.value = value;
|
|
88
|
-
this.end = end;
|
|
89
|
-
this.source = source;
|
|
90
|
-
this.nodes = nodes;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
var Context = function (source, index) {
|
|
94
|
-
this.source = source;
|
|
95
|
-
this.index = index;
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
// https://www.json.org/json-en.html
|
|
99
|
-
Context.prototype = {
|
|
100
|
-
fork: function (nextIndex) {
|
|
101
|
-
return new Context(this.source, nextIndex);
|
|
102
|
-
},
|
|
103
|
-
parse: function () {
|
|
104
|
-
var source = this.source;
|
|
105
|
-
var i = this.skip(IS_WHITESPACE, this.index);
|
|
106
|
-
var fork = this.fork(i);
|
|
107
|
-
var chr = at(source, i);
|
|
108
|
-
if (exec(IS_NUMBER_START, chr)) return fork.number();
|
|
109
|
-
switch (chr) {
|
|
110
|
-
case '{':
|
|
111
|
-
return fork.object();
|
|
112
|
-
case '[':
|
|
113
|
-
return fork.array();
|
|
114
|
-
case '"':
|
|
115
|
-
return fork.string();
|
|
116
|
-
case 't':
|
|
117
|
-
return fork.keyword(true);
|
|
118
|
-
case 'f':
|
|
119
|
-
return fork.keyword(false);
|
|
120
|
-
case 'n':
|
|
121
|
-
return fork.keyword(null);
|
|
122
|
-
} throw new SyntaxError('Unexpected character: "' + chr + '" at: ' + i);
|
|
123
|
-
},
|
|
124
|
-
node: function (type, value, start, end, nodes) {
|
|
125
|
-
return new Node(value, end, type ? null : slice(this.source, start, end), nodes);
|
|
126
|
-
},
|
|
127
|
-
object: function () {
|
|
128
|
-
var source = this.source;
|
|
129
|
-
var i = this.index + 1;
|
|
130
|
-
var expectKeypair = false;
|
|
131
|
-
var object = {};
|
|
132
|
-
var nodes = {};
|
|
133
|
-
while (i < source.length) {
|
|
134
|
-
i = this.until(['"', '}'], i);
|
|
135
|
-
if (at(source, i) === '}' && !expectKeypair) {
|
|
136
|
-
i++;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
// Parsing the key
|
|
140
|
-
var result = this.fork(i).string();
|
|
141
|
-
var key = result.value;
|
|
142
|
-
i = result.end;
|
|
143
|
-
i = this.until([':'], i) + 1;
|
|
144
|
-
// Parsing value
|
|
145
|
-
i = this.skip(IS_WHITESPACE, i);
|
|
146
|
-
result = this.fork(i).parse();
|
|
147
|
-
createProperty(nodes, key, result);
|
|
148
|
-
createProperty(object, key, result.value);
|
|
149
|
-
i = this.until([',', '}'], result.end);
|
|
150
|
-
var chr = at(source, i);
|
|
151
|
-
if (chr === ',') {
|
|
152
|
-
expectKeypair = true;
|
|
153
|
-
i++;
|
|
154
|
-
} else if (chr === '}') {
|
|
155
|
-
i++;
|
|
156
|
-
break;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return this.node(OBJECT, object, this.index, i, nodes);
|
|
160
|
-
},
|
|
161
|
-
array: function () {
|
|
162
|
-
var source = this.source;
|
|
163
|
-
var i = this.index + 1;
|
|
164
|
-
var expectElement = false;
|
|
165
|
-
var array = [];
|
|
166
|
-
var nodes = [];
|
|
167
|
-
while (i < source.length) {
|
|
168
|
-
i = this.skip(IS_WHITESPACE, i);
|
|
169
|
-
if (at(source, i) === ']' && !expectElement) {
|
|
170
|
-
i++;
|
|
171
|
-
break;
|
|
172
|
-
}
|
|
173
|
-
var result = this.fork(i).parse();
|
|
174
|
-
push(nodes, result);
|
|
175
|
-
push(array, result.value);
|
|
176
|
-
i = this.until([',', ']'], result.end);
|
|
177
|
-
if (at(source, i) === ',') {
|
|
178
|
-
expectElement = true;
|
|
179
|
-
i++;
|
|
180
|
-
} else if (at(source, i) === ']') {
|
|
181
|
-
i++;
|
|
182
|
-
break;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return this.node(OBJECT, array, this.index, i, nodes);
|
|
186
|
-
},
|
|
187
|
-
string: function () {
|
|
188
|
-
var index = this.index;
|
|
189
|
-
var parsed = parseJSONString(this.source, this.index + 1);
|
|
190
|
-
return this.node(PRIMITIVE, parsed.value, index, parsed.end);
|
|
191
|
-
},
|
|
192
|
-
number: function () {
|
|
193
|
-
var source = this.source;
|
|
194
|
-
var startIndex = this.index;
|
|
195
|
-
var i = startIndex;
|
|
196
|
-
if (at(source, i) === '-') i++;
|
|
197
|
-
if (at(source, i) === '0') i++;
|
|
198
|
-
else if (exec(IS_NON_ZERO_DIGIT, at(source, i))) i = this.skip(IS_DIGIT, i + 1);
|
|
199
|
-
else throw new SyntaxError('Failed to parse number at: ' + i);
|
|
200
|
-
if (at(source, i) === '.') i = this.skip(IS_DIGIT, i + 1);
|
|
201
|
-
if (at(source, i) === 'e' || at(source, i) === 'E') {
|
|
202
|
-
i++;
|
|
203
|
-
if (at(source, i) === '+' || at(source, i) === '-') i++;
|
|
204
|
-
var exponentStartIndex = i;
|
|
205
|
-
i = this.skip(IS_DIGIT, i);
|
|
206
|
-
if (exponentStartIndex === i) throw new SyntaxError("Failed to parse number's exponent value at: " + i);
|
|
207
|
-
}
|
|
208
|
-
return this.node(PRIMITIVE, Number(slice(source, startIndex, i)), startIndex, i);
|
|
209
|
-
},
|
|
210
|
-
keyword: function (value) {
|
|
211
|
-
var keyword = '' + value;
|
|
212
|
-
var index = this.index;
|
|
213
|
-
var endIndex = index + keyword.length;
|
|
214
|
-
if (slice(this.source, index, endIndex) !== keyword) throw new SyntaxError('Failed to parse value at: ' + index);
|
|
215
|
-
return this.node(PRIMITIVE, value, index, endIndex);
|
|
216
|
-
},
|
|
217
|
-
skip: function (regex, i) {
|
|
218
|
-
var source = this.source;
|
|
219
|
-
for (; i < source.length; i++) if (!exec(regex, at(source, i))) break;
|
|
220
|
-
return i;
|
|
221
|
-
},
|
|
222
|
-
until: function (array, i) {
|
|
223
|
-
i = this.skip(IS_WHITESPACE, i);
|
|
224
|
-
var chr = at(this.source, i);
|
|
225
|
-
for (var j = 0; j < array.length; j++) if (array[j] === chr) return i;
|
|
226
|
-
throw new SyntaxError('Unexpected character: "' + chr + '" at: ' + i);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
var NO_SOURCE_SUPPORT = fails(function () {
|
|
231
|
-
var unsafeInt = '9007199254740993';
|
|
232
|
-
var source;
|
|
233
|
-
nativeParse(unsafeInt, function (key, value, context) {
|
|
234
|
-
source = context.source;
|
|
235
|
-
});
|
|
236
|
-
return source !== unsafeInt;
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
var PROPER_BASE_PARSE = NATIVE_SYMBOL && !fails(function () {
|
|
240
|
-
// Safari 9 bug
|
|
241
|
-
return 1 / nativeParse('-0 \t') !== -Infinity;
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
// `JSON.parse` method
|
|
245
|
-
// https://tc39.es/ecma262/#sec-json.parse
|
|
246
|
-
// https://github.com/tc39/proposal-json-parse-with-source
|
|
247
|
-
$({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, {
|
|
248
|
-
parse: function parse(text, reviver) {
|
|
249
|
-
return PROPER_BASE_PARSE && !isCallable(reviver) ? nativeParse(text) : $parse(text, reviver);
|
|
250
|
-
}
|
|
251
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.json.parse');
|
|
@@ -1,86 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var NATIVE_RAW_JSON = require('../internals/native-raw-json');
|
|
5
|
-
var getBuiltIn = require('../internals/get-built-in');
|
|
6
|
-
var call = require('../internals/function-call');
|
|
7
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
8
|
-
var isCallable = require('../internals/is-callable');
|
|
9
|
-
var isRawJSON = require('../internals/is-raw-json');
|
|
10
|
-
var toString = require('../internals/to-string');
|
|
11
|
-
var createProperty = require('../internals/create-property');
|
|
12
|
-
var parseJSONString = require('../internals/parse-json-string');
|
|
13
|
-
var getReplacerFunction = require('../internals/get-json-replacer-function');
|
|
14
|
-
var uid = require('../internals/uid');
|
|
15
|
-
var setInternalState = require('../internals/internal-state').set;
|
|
16
|
-
|
|
17
|
-
var $String = String;
|
|
18
|
-
var $SyntaxError = SyntaxError;
|
|
19
|
-
var parse = getBuiltIn('JSON', 'parse');
|
|
20
|
-
var $stringify = getBuiltIn('JSON', 'stringify');
|
|
21
|
-
var create = getBuiltIn('Object', 'create');
|
|
22
|
-
var freeze = getBuiltIn('Object', 'freeze');
|
|
23
|
-
var at = uncurryThis(''.charAt);
|
|
24
|
-
var slice = uncurryThis(''.slice);
|
|
25
|
-
var push = uncurryThis([].push);
|
|
26
|
-
|
|
27
|
-
var MARK = uid();
|
|
28
|
-
var MARK_LENGTH = MARK.length;
|
|
29
|
-
var ERROR_MESSAGE = 'Unacceptable as raw JSON';
|
|
30
|
-
|
|
31
|
-
var isWhitespace = function (it) {
|
|
32
|
-
return it === ' ' || it === '\t' || it === '\n' || it === '\r';
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// `JSON.rawJSON` method
|
|
36
|
-
// https://tc39.es/proposal-json-parse-with-source/#sec-json.rawjson
|
|
37
|
-
// https://github.com/tc39/proposal-json-parse-with-source
|
|
38
|
-
$({ target: 'JSON', stat: true, forced: !NATIVE_RAW_JSON }, {
|
|
39
|
-
rawJSON: function rawJSON(text) {
|
|
40
|
-
var jsonString = toString(text);
|
|
41
|
-
if (jsonString === '' || isWhitespace(at(jsonString, 0)) || isWhitespace(at(jsonString, jsonString.length - 1))) {
|
|
42
|
-
throw new $SyntaxError(ERROR_MESSAGE);
|
|
43
|
-
}
|
|
44
|
-
var parsed = parse(jsonString);
|
|
45
|
-
if (typeof parsed == 'object' && parsed !== null) throw new $SyntaxError(ERROR_MESSAGE);
|
|
46
|
-
var obj = create(null);
|
|
47
|
-
setInternalState(obj, { type: 'RawJSON' });
|
|
48
|
-
createProperty(obj, 'rawJSON', jsonString);
|
|
49
|
-
return FREEZING ? freeze(obj) : obj;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// `JSON.stringify` method
|
|
54
|
-
// https://tc39.es/ecma262/#sec-json.stringify
|
|
55
|
-
// https://github.com/tc39/proposal-json-parse-with-source
|
|
56
|
-
if ($stringify) $({ target: 'JSON', stat: true, arity: 3, forced: !NATIVE_RAW_JSON }, {
|
|
57
|
-
stringify: function stringify(text, replacer, space) {
|
|
58
|
-
var replacerFunction = getReplacerFunction(replacer);
|
|
59
|
-
var rawStrings = [];
|
|
60
|
-
|
|
61
|
-
var json = $stringify(text, function (key, value) {
|
|
62
|
-
// some old implementations (like WebKit) could pass numbers as keys
|
|
63
|
-
var v = isCallable(replacerFunction) ? call(replacerFunction, this, $String(key), value) : value;
|
|
64
|
-
return isRawJSON(v) ? MARK + (push(rawStrings, v.rawJSON) - 1) : v;
|
|
65
|
-
}, space);
|
|
66
|
-
|
|
67
|
-
if (typeof json != 'string') return json;
|
|
68
|
-
|
|
69
|
-
var result = '';
|
|
70
|
-
var length = json.length;
|
|
71
|
-
|
|
72
|
-
for (var i = 0; i < length; i++) {
|
|
73
|
-
var chr = at(json, i);
|
|
74
|
-
if (chr === '"') {
|
|
75
|
-
var end = parseJSONString(json, ++i).end - 1;
|
|
76
|
-
var string = slice(json, i, end);
|
|
77
|
-
result += slice(string, 0, MARK_LENGTH) === MARK
|
|
78
|
-
? rawStrings[slice(string, MARK_LENGTH)]
|
|
79
|
-
: '"' + string + '"';
|
|
80
|
-
i = end;
|
|
81
|
-
} else result += chr;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return result;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.json.raw-json');
|
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var aMap = require('../internals/a-map');
|
|
5
|
-
var MapHelpers = require('../internals/map-helpers');
|
|
6
|
-
var IS_PURE = require('../internals/is-pure');
|
|
7
|
-
|
|
8
|
-
var get = MapHelpers.get;
|
|
9
|
-
var has = MapHelpers.has;
|
|
10
|
-
var set = MapHelpers.set;
|
|
11
|
-
|
|
12
|
-
// `Map.prototype.getOrInsertComputed` method
|
|
13
|
-
// https://github.com/tc39/proposal-upsert
|
|
14
|
-
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
|
|
15
|
-
getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {
|
|
16
|
-
aMap(this);
|
|
17
|
-
aCallable(callbackfn);
|
|
18
|
-
if (has(this, key)) return get(this, key);
|
|
19
|
-
// CanonicalizeKeyedCollectionKey
|
|
20
|
-
if (key === 0 && 1 / key === -Infinity) key = 0;
|
|
21
|
-
var value = callbackfn(key);
|
|
22
|
-
set(this, key, value);
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.map.get-or-insert-computed');
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var MapHelpers = require('../internals/map-helpers');
|
|
5
|
-
var IS_PURE = require('../internals/is-pure');
|
|
6
|
-
|
|
7
|
-
var get = MapHelpers.get;
|
|
8
|
-
var has = MapHelpers.has;
|
|
9
|
-
var set = MapHelpers.set;
|
|
10
|
-
|
|
11
|
-
// `Map.prototype.getOrInsert` method
|
|
12
|
-
// https://github.com/tc39/proposal-upsert
|
|
13
|
-
$({ target: 'Map', proto: true, real: true, forced: IS_PURE }, {
|
|
14
|
-
getOrInsert: function getOrInsert(key, value) {
|
|
15
|
-
if (has(aMap(this), key)) return get(this, key);
|
|
16
|
-
set(this, key, value);
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.map.get-or-insert');
|
|
@@ -1,36 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var aWeakMap = require('../internals/a-weak-map');
|
|
5
|
-
var aWeakKey = require('../internals/a-weak-key');
|
|
6
|
-
var WeakMapHelpers = require('../internals/weak-map-helpers');
|
|
7
|
-
var IS_PURE = require('../internals/is-pure');
|
|
8
|
-
|
|
9
|
-
var get = WeakMapHelpers.get;
|
|
10
|
-
var has = WeakMapHelpers.has;
|
|
11
|
-
var set = WeakMapHelpers.set;
|
|
12
|
-
|
|
13
|
-
var FORCED = IS_PURE || !function () {
|
|
14
|
-
try {
|
|
15
|
-
// eslint-disable-next-line es/no-weak-map, no-throw-literal -- testing
|
|
16
|
-
if (WeakMap.prototype.getOrInsertComputed) new WeakMap().getOrInsertComputed(1, function () { throw 1; });
|
|
17
|
-
} catch (error) {
|
|
18
|
-
// FF144 Nightly - Beta 3 bug
|
|
19
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=1988369
|
|
20
|
-
return error instanceof TypeError;
|
|
21
|
-
}
|
|
22
|
-
}();
|
|
23
|
-
|
|
24
|
-
// `WeakMap.prototype.getOrInsertComputed` method
|
|
25
|
-
// https://github.com/tc39/proposal-upsert
|
|
26
|
-
$({ target: 'WeakMap', proto: true, real: true, forced: FORCED }, {
|
|
27
|
-
getOrInsertComputed: function getOrInsertComputed(key, callbackfn) {
|
|
28
|
-
aWeakMap(this);
|
|
29
|
-
aWeakKey(key);
|
|
30
|
-
aCallable(callbackfn);
|
|
31
|
-
if (has(this, key)) return get(this, key);
|
|
32
|
-
var value = callbackfn(key);
|
|
33
|
-
set(this, key, value);
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.weak-map.get-or-insert-computed');
|
|
@@ -1,19 +1,3 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var WeakMapHelpers = require('../internals/weak-map-helpers');
|
|
5
|
-
var IS_PURE = require('../internals/is-pure');
|
|
6
|
-
|
|
7
|
-
var get = WeakMapHelpers.get;
|
|
8
|
-
var has = WeakMapHelpers.has;
|
|
9
|
-
var set = WeakMapHelpers.set;
|
|
10
|
-
|
|
11
|
-
// `WeakMap.prototype.getOrInsert` method
|
|
12
|
-
// https://github.com/tc39/proposal-upsert
|
|
13
|
-
$({ target: 'WeakMap', proto: true, real: true, forced: IS_PURE }, {
|
|
14
|
-
getOrInsert: function getOrInsert(key, value) {
|
|
15
|
-
if (has(aWeakMap(this), key)) return get(this, key);
|
|
16
|
-
set(this, key, value);
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
2
|
+
// TODO: Remove from `core-js@4`
|
|
3
|
+
require('../modules/es.weak-map.get-or-insert');
|
|
@@ -313,7 +313,7 @@ defineBuiltIns(URLSearchParamsPrototype, {
|
|
|
313
313
|
var state = getInternalParamsState(this);
|
|
314
314
|
validateArgumentsLength(arguments.length, 2);
|
|
315
315
|
push(state.entries, { key: $toString(name), value: $toString(value) });
|
|
316
|
-
if (!DESCRIPTORS) this.
|
|
316
|
+
if (!DESCRIPTORS) this.size++;
|
|
317
317
|
state.updateURL();
|
|
318
318
|
},
|
|
319
319
|
// `URLSearchParams.prototype.delete` method
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "core-js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.48.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"description": "Standard library",
|
|
6
6
|
"keywords": [
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"email": "zloirock@zloirock.ru",
|
|
71
71
|
"url": "http://zloirock.ru"
|
|
72
72
|
},
|
|
73
|
+
"sideEffects": true,
|
|
73
74
|
"main": "index.js",
|
|
74
75
|
"scripts": {
|
|
75
76
|
"postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
|
package/stable/index.js
CHANGED
|
@@ -84,6 +84,7 @@ require('../modules/es.function.has-instance');
|
|
|
84
84
|
require('../modules/es.function.name');
|
|
85
85
|
require('../modules/es.global-this');
|
|
86
86
|
require('../modules/es.iterator.constructor');
|
|
87
|
+
require('../modules/es.iterator.concat');
|
|
87
88
|
require('../modules/es.iterator.dispose');
|
|
88
89
|
require('../modules/es.iterator.drop');
|
|
89
90
|
require('../modules/es.iterator.every');
|
|
@@ -97,10 +98,15 @@ require('../modules/es.iterator.reduce');
|
|
|
97
98
|
require('../modules/es.iterator.some');
|
|
98
99
|
require('../modules/es.iterator.take');
|
|
99
100
|
require('../modules/es.iterator.to-array');
|
|
101
|
+
require('../modules/es.json.is-raw-json');
|
|
102
|
+
require('../modules/es.json.parse');
|
|
103
|
+
require('../modules/es.json.raw-json');
|
|
100
104
|
require('../modules/es.json.stringify');
|
|
101
105
|
require('../modules/es.json.to-string-tag');
|
|
102
106
|
require('../modules/es.map');
|
|
103
107
|
require('../modules/es.map.group-by');
|
|
108
|
+
require('../modules/es.map.get-or-insert');
|
|
109
|
+
require('../modules/es.map.get-or-insert-computed');
|
|
104
110
|
require('../modules/es.math.acosh');
|
|
105
111
|
require('../modules/es.math.asinh');
|
|
106
112
|
require('../modules/es.math.atanh');
|
|
@@ -287,6 +293,8 @@ require('../modules/es.uint8-array.to-base64');
|
|
|
287
293
|
require('../modules/es.uint8-array.to-hex');
|
|
288
294
|
require('../modules/es.unescape');
|
|
289
295
|
require('../modules/es.weak-map');
|
|
296
|
+
require('../modules/es.weak-map.get-or-insert');
|
|
297
|
+
require('../modules/es.weak-map.get-or-insert-computed');
|
|
290
298
|
require('../modules/es.weak-set');
|
|
291
299
|
require('../modules/web.atob');
|
|
292
300
|
require('../modules/web.btoa');
|
package/stage/2.7.js
CHANGED
package/stage/3.js
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
var parent = require('./4');
|
|
3
3
|
|
|
4
4
|
require('../proposals/decorator-metadata-v2');
|
|
5
|
-
require('../proposals/
|
|
6
|
-
require('../proposals/json-parse-with-source');
|
|
7
|
-
require('../proposals/map-upsert-v4');
|
|
5
|
+
require('../proposals/joint-iteration');
|
|
8
6
|
// TODO: Obsolete versions, remove from `core-js@4`
|
|
9
7
|
require('../proposals/array-grouping-stage-3');
|
|
10
8
|
require('../proposals/array-grouping-stage-3-2');
|
package/stage/4.js
CHANGED
|
@@ -13,6 +13,9 @@ require('../proposals/float16');
|
|
|
13
13
|
require('../proposals/global-this');
|
|
14
14
|
require('../proposals/is-error');
|
|
15
15
|
require('../proposals/iterator-helpers-stage-3-2');
|
|
16
|
+
require('../proposals/iterator-sequencing');
|
|
17
|
+
require('../proposals/json-parse-with-source');
|
|
18
|
+
require('../proposals/map-upsert-v4');
|
|
16
19
|
require('../proposals/math-sum');
|
|
17
20
|
require('../proposals/promise-all-settled');
|
|
18
21
|
require('../proposals/promise-any');
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
|
3
|
-
|
|
4
|
-
// https://tc39.es/ecma262/#sec-array.prototype.toreversed
|
|
5
|
-
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.toreversed
|
|
6
|
-
module.exports = function (O, C) {
|
|
7
|
-
var len = lengthOfArrayLike(O);
|
|
8
|
-
var A = new C(len);
|
|
9
|
-
var k = 0;
|
|
10
|
-
for (; k < len; k++) A[k] = O[len - k - 1];
|
|
11
|
-
return A;
|
|
12
|
-
};
|
package/internals/array-with.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var lengthOfArrayLike = require('../internals/length-of-array-like');
|
|
3
|
-
var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
|
|
4
|
-
|
|
5
|
-
var $RangeError = RangeError;
|
|
6
|
-
|
|
7
|
-
// https://tc39.es/ecma262/#sec-array.prototype.with
|
|
8
|
-
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.with
|
|
9
|
-
module.exports = function (O, C, index, value) {
|
|
10
|
-
var len = lengthOfArrayLike(O);
|
|
11
|
-
var relativeIndex = toIntegerOrInfinity(index);
|
|
12
|
-
var actualIndex = relativeIndex < 0 ? len + relativeIndex : relativeIndex;
|
|
13
|
-
if (actualIndex >= len || actualIndex < 0) throw new $RangeError('Incorrect index');
|
|
14
|
-
var A = new C(len);
|
|
15
|
-
var k = 0;
|
|
16
|
-
for (; k < len; k++) A[k] = k === actualIndex ? value : O[k];
|
|
17
|
-
return A;
|
|
18
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
var uncurryThis = require('../internals/function-uncurry-this');
|
|
3
|
-
var isArray = require('../internals/is-array');
|
|
4
|
-
var isCallable = require('../internals/is-callable');
|
|
5
|
-
var classof = require('../internals/classof-raw');
|
|
6
|
-
var toString = require('../internals/to-string');
|
|
7
|
-
|
|
8
|
-
var push = uncurryThis([].push);
|
|
9
|
-
|
|
10
|
-
module.exports = function (replacer) {
|
|
11
|
-
if (isCallable(replacer)) return replacer;
|
|
12
|
-
if (!isArray(replacer)) return;
|
|
13
|
-
var rawLength = replacer.length;
|
|
14
|
-
var keys = [];
|
|
15
|
-
for (var i = 0; i < rawLength; i++) {
|
|
16
|
-
var element = replacer[i];
|
|
17
|
-
if (typeof element == 'string') push(keys, element);
|
|
18
|
-
else if (typeof element == 'number' || classof(element) === 'Number' || classof(element) === 'String') push(keys, toString(element));
|
|
19
|
-
}
|
|
20
|
-
var keysLength = keys.length;
|
|
21
|
-
var root = true;
|
|
22
|
-
return function (key, value) {
|
|
23
|
-
if (root) {
|
|
24
|
-
root = false;
|
|
25
|
-
return value;
|
|
26
|
-
}
|
|
27
|
-
if (isArray(this)) return value;
|
|
28
|
-
for (var j = 0; j < keysLength; j++) if (keys[j] === key) return value;
|
|
29
|
-
};
|
|
30
|
-
};
|