core-js-pure 3.3.6 → 3.4.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.
@@ -1,6 +1,9 @@
1
+ require('../../modules/es.json.stringify');
1
2
  var core = require('../../internals/path');
2
- var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
3
3
 
4
- module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
5
- return $JSON.stringify.apply($JSON, arguments);
4
+ if (!core.JSON) core.JSON = { stringify: JSON.stringify };
5
+
6
+ // eslint-disable-next-line no-unused-vars
7
+ module.exports = function stringify(it, replacer, space) {
8
+ return core.JSON.stringify.apply(null, arguments);
6
9
  };
@@ -4,7 +4,7 @@ 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.3.6',
7
+ version: '3.4.0',
8
8
  mode: IS_PURE ? 'pure' : 'global',
9
9
  copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
10
10
  });
@@ -17,6 +17,6 @@ module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () {
17
17
  new Int8Array(1.5);
18
18
  new Int8Array(iterable);
19
19
  }, true) || fails(function () {
20
- // Safari 11 bug
20
+ // Safari (11+) bug - a reason why even Safari 13 should load a typed array polyfill
21
21
  return new Int8Array(new ArrayBuffer(2), 1, undefined).length !== 1;
22
22
  });
@@ -0,0 +1,32 @@
1
+ var $ = require('../internals/export');
2
+ var getBuiltIn = require('../internals/get-built-in');
3
+ var fails = require('../internals/fails');
4
+
5
+ var $stringify = getBuiltIn('JSON', 'stringify');
6
+ var re = /[\uD800-\uDFFF]/g;
7
+ var low = /^[\uD800-\uDBFF]$/;
8
+ var hi = /^[\uDC00-\uDFFF]$/;
9
+
10
+ var fix = function (match, offset, string) {
11
+ var prev = string.charAt(offset - 1);
12
+ var next = string.charAt(offset + 1);
13
+ if ((low.test(match) && !hi.test(next)) || (hi.test(match) && !low.test(prev))) {
14
+ return '\\u' + match.charCodeAt(0).toString(16);
15
+ } return match;
16
+ };
17
+
18
+ var FORCED = fails(function () {
19
+ return $stringify('\uDF06\uD834') !== '"\\udf06\\ud834"'
20
+ || $stringify('\uDEAD') !== '"\\udead"';
21
+ });
22
+
23
+ if ($stringify) {
24
+ // https://github.com/tc39/proposal-well-formed-stringify
25
+ $({ target: 'JSON', stat: true, forced: FORCED }, {
26
+ // eslint-disable-next-line no-unused-vars
27
+ stringify: function stringify(it, replacer, space) {
28
+ var result = $stringify.apply(null, arguments);
29
+ return typeof result == 'string' ? result.replace(re, fix) : result;
30
+ }
31
+ });
32
+ }
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
  var $ = require('../internals/export');
3
3
  var global = require('../internals/global');
4
+ var getBuiltIn = require('../internals/get-built-in');
4
5
  var IS_PURE = require('../internals/is-pure');
5
6
  var DESCRIPTORS = require('../internals/descriptors');
6
7
  var NATIVE_SYMBOL = require('../internals/native-symbol');
@@ -42,8 +43,7 @@ var setInternalState = InternalStateModule.set;
42
43
  var getInternalState = InternalStateModule.getterFor(SYMBOL);
43
44
  var ObjectPrototype = Object[PROTOTYPE];
44
45
  var $Symbol = global.Symbol;
45
- var JSON = global.JSON;
46
- var nativeJSONStringify = JSON && JSON.stringify;
46
+ var $stringify = getBuiltIn('JSON', 'stringify');
47
47
  var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
48
48
  var nativeDefineProperty = definePropertyModule.f;
49
49
  var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f;
@@ -264,30 +264,35 @@ $({ target: 'Object', stat: true, forced: fails(function () { getOwnPropertySymb
264
264
 
265
265
  // `JSON.stringify` method behavior with symbols
266
266
  // https://tc39.github.io/ecma262/#sec-json.stringify
267
- JSON && $({ target: 'JSON', stat: true, forced: !NATIVE_SYMBOL || fails(function () {
268
- var symbol = $Symbol();
269
- // MS Edge converts symbol values to JSON as {}
270
- return nativeJSONStringify([symbol]) != '[null]'
271
- // WebKit converts symbol values to JSON as null
272
- || nativeJSONStringify({ a: symbol }) != '{}'
273
- // V8 throws on boxed symbols
274
- || nativeJSONStringify(Object(symbol)) != '{}';
275
- }) }, {
276
- stringify: function stringify(it) {
277
- var args = [it];
278
- var index = 1;
279
- var replacer, $replacer;
280
- while (arguments.length > index) args.push(arguments[index++]);
281
- $replacer = replacer = args[1];
282
- if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
283
- if (!isArray(replacer)) replacer = function (key, value) {
284
- if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
285
- if (!isSymbol(value)) return value;
286
- };
287
- args[1] = replacer;
288
- return nativeJSONStringify.apply(JSON, args);
289
- }
290
- });
267
+ if ($stringify) {
268
+ var FORCED_JSON_STRINGIFY = !NATIVE_SYMBOL || fails(function () {
269
+ var symbol = $Symbol();
270
+ // MS Edge converts symbol values to JSON as {}
271
+ return $stringify([symbol]) != '[null]'
272
+ // WebKit converts symbol values to JSON as null
273
+ || $stringify({ a: symbol }) != '{}'
274
+ // V8 throws on boxed symbols
275
+ || $stringify(Object(symbol)) != '{}';
276
+ });
277
+
278
+ $({ target: 'JSON', stat: true, forced: FORCED_JSON_STRINGIFY }, {
279
+ // eslint-disable-next-line no-unused-vars
280
+ stringify: function stringify(it, replacer, space) {
281
+ var args = [it];
282
+ var index = 1;
283
+ var $replacer;
284
+ while (arguments.length > index) args.push(arguments[index++]);
285
+ $replacer = replacer;
286
+ if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
287
+ if (!isArray(replacer)) replacer = function (key, value) {
288
+ if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
289
+ if (!isSymbol(value)) return value;
290
+ };
291
+ args[1] = replacer;
292
+ return $stringify.apply(null, args);
293
+ }
294
+ });
295
+ }
291
296
 
292
297
  // `Symbol.prototype[@@toPrimitive]` method
293
298
  // https://tc39.github.io/ecma262/#sec-symbol.prototype-@@toprimitive
@@ -4,6 +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
- return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;
7
+ return (x = +x) == x && x == 0 ? 1 / x == -Infinity : x < 0;
8
8
  }
9
9
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "core-js-pure",
3
3
  "description": "Standard library",
4
- "version": "3.3.6",
4
+ "version": "3.4.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/zloirock/core-js.git"