core-js-pure 3.22.0 → 3.22.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.
@@ -1,5 +1,4 @@
1
1
  require('../../modules/es.regexp.flags');
2
- var uncurryThis = require('../../internals/function-uncurry-this');
3
- var regExpFlags = require('../../internals/regexp-flags');
2
+ var getRegExpFlags = require('../../internals/regexp-get-flags');
4
3
 
5
- module.exports = uncurryThis(regExpFlags);
4
+ module.exports = getRegExpFlags;
@@ -6,6 +6,7 @@ var anObject = require('../internals/an-object');
6
6
  module.exports = function () {
7
7
  var that = anObject(this);
8
8
  var result = '';
9
+ if (that.hasIndices) result += 'd';
9
10
  if (that.global) result += 'g';
10
11
  if (that.ignoreCase) result += 'i';
11
12
  if (that.multiline) result += 'm';
@@ -0,0 +1,12 @@
1
+ var call = require('../internals/function-call');
2
+ var hasOwn = require('../internals/has-own-property');
3
+ var isPrototypeOf = require('../internals/object-is-prototype-of');
4
+ var regExpFlags = require('../internals/regexp-flags');
5
+
6
+ var RegExpPrototype = RegExp.prototype;
7
+
8
+ module.exports = function (R) {
9
+ var flags = R.flags;
10
+ return flags === undefined && !('flags' in RegExpPrototype) && !hasOwn(R, 'flags') && isPrototypeOf(RegExpPrototype, R)
11
+ ? call(regExpFlags, R) : flags;
12
+ };
@@ -4,9 +4,9 @@ var store = require('../internals/shared-store');
4
4
  (module.exports = function (key, value) {
5
5
  return store[key] || (store[key] = value !== undefined ? value : {});
6
6
  })('versions', []).push({
7
- version: '3.22.0',
7
+ version: '3.22.1',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
10
- license: 'https://github.com/zloirock/core-js/blob/v3.22.0/LICENSE',
10
+ license: 'https://github.com/zloirock/core-js/blob/v3.22.1/LICENSE',
11
11
  source: 'https://github.com/zloirock/core-js'
12
12
  });
@@ -10,9 +10,8 @@ var toLength = require('../internals/to-length');
10
10
  var toString = require('../internals/to-string');
11
11
  var anObject = require('../internals/an-object');
12
12
  var classof = require('../internals/classof-raw');
13
- var isPrototypeOf = require('../internals/object-is-prototype-of');
14
13
  var isRegExp = require('../internals/is-regexp');
15
- var regExpFlags = require('../internals/regexp-flags');
14
+ var getRegExpFlags = require('../internals/regexp-get-flags');
16
15
  var getMethod = require('../internals/get-method');
17
16
  var redefine = require('../internals/redefine');
18
17
  var fails = require('../internals/fails');
@@ -30,7 +29,6 @@ var setInternalState = InternalStateModule.set;
30
29
  var getInternalState = InternalStateModule.getterFor(REGEXP_STRING_ITERATOR);
31
30
  var RegExpPrototype = RegExp.prototype;
32
31
  var TypeError = global.TypeError;
33
- var getFlags = uncurryThis(regExpFlags);
34
32
  var stringIndexOf = uncurryThis(''.indexOf);
35
33
  var un$MatchAll = uncurryThis(''.matchAll);
36
34
 
@@ -65,13 +63,9 @@ var $RegExpStringIterator = createIteratorConstructor(function RegExpStringItera
65
63
  var $matchAll = function (string) {
66
64
  var R = anObject(this);
67
65
  var S = toString(string);
68
- var C, flagsValue, flags, matcher, $global, fullUnicode;
69
- C = speciesConstructor(R, RegExp);
70
- flagsValue = R.flags;
71
- if (flagsValue === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype)) {
72
- flagsValue = getFlags(R);
73
- }
74
- flags = flagsValue === undefined ? '' : toString(flagsValue);
66
+ var C = speciesConstructor(R, RegExp);
67
+ var flags = toString(getRegExpFlags(R));
68
+ var matcher, $global, fullUnicode;
75
69
  matcher = new C(C === RegExp ? R.source : R, flags);
76
70
  $global = !!~stringIndexOf(flags, 'g');
77
71
  fullUnicode = !!~stringIndexOf(flags, 'u');
@@ -87,10 +81,7 @@ $({ target: 'String', proto: true, forced: WORKS_WITH_NON_GLOBAL_REGEX }, {
87
81
  var flags, S, matcher, rx;
88
82
  if (regexp != null) {
89
83
  if (isRegExp(regexp)) {
90
- flags = toString(requireObjectCoercible('flags' in RegExpPrototype
91
- ? regexp.flags
92
- : getFlags(regexp)
93
- ));
84
+ flags = toString(requireObjectCoercible(getRegExpFlags(regexp)));
94
85
  if (!~stringIndexOf(flags, 'g')) throw TypeError('`.matchAll` does not allow non-global regexes');
95
86
  }
96
87
  if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp);
@@ -8,15 +8,13 @@ var isCallable = require('../internals/is-callable');
8
8
  var isRegExp = require('../internals/is-regexp');
9
9
  var toString = require('../internals/to-string');
10
10
  var getMethod = require('../internals/get-method');
11
- var regExpFlags = require('../internals/regexp-flags');
11
+ var getRegExpFlags = require('../internals/regexp-get-flags');
12
12
  var getSubstitution = require('../internals/get-substitution');
13
13
  var wellKnownSymbol = require('../internals/well-known-symbol');
14
14
  var IS_PURE = require('../internals/is-pure');
15
15
 
16
16
  var REPLACE = wellKnownSymbol('replace');
17
- var RegExpPrototype = RegExp.prototype;
18
17
  var TypeError = global.TypeError;
19
- var getFlags = uncurryThis(regExpFlags);
20
18
  var indexOf = uncurryThis(''.indexOf);
21
19
  var replace = uncurryThis(''.replace);
22
20
  var stringSlice = uncurryThis(''.slice);
@@ -40,10 +38,7 @@ $({ target: 'String', proto: true }, {
40
38
  if (searchValue != null) {
41
39
  IS_REG_EXP = isRegExp(searchValue);
42
40
  if (IS_REG_EXP) {
43
- flags = toString(requireObjectCoercible('flags' in RegExpPrototype
44
- ? searchValue.flags
45
- : getFlags(searchValue)
46
- ));
41
+ flags = toString(requireObjectCoercible(getRegExpFlags(searchValue)));
47
42
  if (!~indexOf(flags, 'g')) throw TypeError('`.replaceAll` does not allow non-global regexes');
48
43
  }
49
44
  replacer = getMethod(searchValue, REPLACE);
@@ -17,7 +17,7 @@ var createProperty = require('../internals/create-property');
17
17
  var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
18
18
  var lengthOfArrayLike = require('../internals/length-of-array-like');
19
19
  var validateArgumentsLength = require('../internals/validate-arguments-length');
20
- var regExpFlags = require('../internals/regexp-flags');
20
+ var getRegExpFlags = require('../internals/regexp-get-flags');
21
21
  var ERROR_STACK_INSTALLABLE = require('../internals/error-stack-installable');
22
22
 
23
23
  var Object = global.Object;
@@ -47,7 +47,6 @@ var push = uncurryThis([].push);
47
47
  var booleanValueOf = uncurryThis(true.valueOf);
48
48
  var numberValueOf = uncurryThis(1.0.valueOf);
49
49
  var stringValueOf = uncurryThis(''.valueOf);
50
- var getFlags = uncurryThis(regExpFlags);
51
50
  var getTime = uncurryThis(Date.prototype.getTime);
52
51
  var PERFORMANCE_MARK = uid('structuredClone');
53
52
  var DATA_CLONE_ERROR = 'DataCloneError';
@@ -133,7 +132,7 @@ var structuredCloneInternal = function (value, map) {
133
132
  case 'RegExp':
134
133
  // in this block because of a Safari 14.1 bug
135
134
  // old FF does not clone regexes passed to the constructor, so get the source and flags directly
136
- cloned = new RegExp(value.source, 'flags' in value ? value.flags : getFlags(value));
135
+ cloned = new RegExp(value.source, getRegExpFlags(value));
137
136
  break;
138
137
  case 'Error':
139
138
  name = value.name;
@@ -3,9 +3,9 @@
3
3
  require('../modules/es.array.iterator');
4
4
  var $ = require('../internals/export');
5
5
  var global = require('../internals/global');
6
- var getBuiltIn = require('../internals/get-built-in');
7
6
  var call = require('../internals/function-call');
8
7
  var uncurryThis = require('../internals/function-uncurry-this');
8
+ var DESCRIPTORS = require('../internals/descriptors');
9
9
  var USE_NATIVE_URL = require('../internals/native-url');
10
10
  var redefine = require('../internals/redefine');
11
11
  var redefineAll = require('../internals/redefine-all');
@@ -34,11 +34,20 @@ var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator';
34
34
  var setInternalState = InternalStateModule.set;
35
35
  var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS);
36
36
  var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR);
37
+ // eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
38
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
37
39
 
38
- var n$Fetch = getBuiltIn('fetch');
39
- var N$Request = getBuiltIn('Request');
40
- var Headers = getBuiltIn('Headers');
41
- var RequestPrototype = N$Request && N$Request.prototype;
40
+ // Avoid NodeJS experimental warning
41
+ var safeGetBuiltIn = function (name) {
42
+ if (!DESCRIPTORS) return global(name);
43
+ var descriptor = getOwnPropertyDescriptor(global, name);
44
+ return descriptor && descriptor.value;
45
+ };
46
+
47
+ var nativeFetch = safeGetBuiltIn('fetch');
48
+ var NativeRequest = safeGetBuiltIn('Request');
49
+ var Headers = safeGetBuiltIn('Headers');
50
+ var RequestPrototype = NativeRequest && NativeRequest.prototype;
42
51
  var HeadersPrototype = Headers && Headers.prototype;
43
52
  var RegExp = global.RegExp;
44
53
  var TypeError = global.TypeError;
@@ -354,24 +363,24 @@ if (!USE_NATIVE_URL && isCallable(Headers)) {
354
363
  } return init;
355
364
  };
356
365
 
357
- if (isCallable(n$Fetch)) {
358
- $({ global: true, enumerable: true, forced: true }, {
366
+ if (isCallable(nativeFetch)) {
367
+ $({ global: true, enumerable: true, noTargetGet: true, forced: true }, {
359
368
  fetch: function fetch(input /* , init */) {
360
- return n$Fetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
369
+ return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
361
370
  }
362
371
  });
363
372
  }
364
373
 
365
- if (isCallable(N$Request)) {
374
+ if (isCallable(NativeRequest)) {
366
375
  var RequestConstructor = function Request(input /* , init */) {
367
376
  anInstance(this, RequestPrototype);
368
- return new N$Request(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
377
+ return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
369
378
  };
370
379
 
371
380
  RequestPrototype.constructor = RequestConstructor;
372
381
  RequestConstructor.prototype = RequestPrototype;
373
382
 
374
- $({ global: true, forced: true }, {
383
+ $({ global: true, forced: true, noTargetGet: true }, {
375
384
  Request: RequestConstructor
376
385
  });
377
386
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js-pure",
3
3
  "description": "Standard library",
4
- "version": "3.22.0",
4
+ "version": "3.22.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"
@@ -54,5 +54,5 @@
54
54
  "scripts": {
55
55
  "postinstall": "node -e \"try{require('./postinstall')}catch(e){}\""
56
56
  },
57
- "gitHead": "c5e56b664756455f9715481eca92f4a3a421f475"
57
+ "gitHead": "48aafd056bb4fbe0ea749d0ad371b15dd2cf51fc"
58
58
  }