core-js-pure 3.4.6 → 3.6.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/es/index.js +2 -0
- package/es/regexp/index.js +2 -0
- package/es/regexp/sticky.js +5 -0
- package/es/regexp/test.js +5 -0
- package/features/instance/match-all.js +3 -0
- package/features/object/index.js +3 -0
- package/features/object/iterate-entries.js +4 -0
- package/features/object/iterate-keys.js +4 -0
- package/features/object/iterate-values.js +4 -0
- package/features/regexp/sticky.js +3 -0
- package/features/regexp/test.js +3 -0
- package/internals/inspect-source.js +9 -4
- package/internals/object-create.js +48 -19
- package/internals/object-iterator.js +37 -0
- package/internals/regexp-sticky-helpers.js +1 -0
- package/internals/shared.js +1 -1
- package/modules/es.regexp.sticky.js +1 -0
- package/modules/es.regexp.test.js +1 -0
- package/modules/esnext.object.iterate-entries.js +11 -0
- package/modules/esnext.object.iterate-keys.js +11 -0
- package/modules/esnext.object.iterate-values.js +11 -0
- package/package.json +1 -1
- package/proposals/object-iteration.js +3 -0
- package/stable/regexp/sticky.js +3 -0
- package/stable/regexp/test.js +3 -0
- package/stage/1.js +1 -0
package/es/index.js
CHANGED
|
@@ -105,6 +105,8 @@ require('../modules/es.string.sup');
|
|
|
105
105
|
require('../modules/es.regexp.constructor');
|
|
106
106
|
require('../modules/es.regexp.exec');
|
|
107
107
|
require('../modules/es.regexp.flags');
|
|
108
|
+
require('../modules/es.regexp.sticky');
|
|
109
|
+
require('../modules/es.regexp.test');
|
|
108
110
|
require('../modules/es.regexp.to-string');
|
|
109
111
|
require('../modules/es.parse-int');
|
|
110
112
|
require('../modules/es.parse-float');
|
package/es/regexp/index.js
CHANGED
|
@@ -2,6 +2,8 @@ require('../../modules/es.regexp.constructor');
|
|
|
2
2
|
require('../../modules/es.regexp.to-string');
|
|
3
3
|
require('../../modules/es.regexp.exec');
|
|
4
4
|
require('../../modules/es.regexp.flags');
|
|
5
|
+
require('../../modules/es.regexp.sticky');
|
|
6
|
+
require('../../modules/es.regexp.test');
|
|
5
7
|
require('../../modules/es.string.match');
|
|
6
8
|
require('../../modules/es.string.replace');
|
|
7
9
|
require('../../modules/es.string.search');
|
package/features/object/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
var
|
|
1
|
+
var store = require('../internals/shared-store');
|
|
2
2
|
|
|
3
3
|
var functionToString = Function.toString;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
// this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
|
|
6
|
+
if (typeof store.inspectSource != 'function') {
|
|
7
|
+
store.inspectSource = function (it) {
|
|
8
|
+
return functionToString.call(it);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
module.exports = store.inspectSource;
|
|
@@ -5,45 +5,74 @@ var hiddenKeys = require('../internals/hidden-keys');
|
|
|
5
5
|
var html = require('../internals/html');
|
|
6
6
|
var documentCreateElement = require('../internals/document-create-element');
|
|
7
7
|
var sharedKey = require('../internals/shared-key');
|
|
8
|
-
var IE_PROTO = sharedKey('IE_PROTO');
|
|
9
8
|
|
|
9
|
+
var GT = '>';
|
|
10
|
+
var LT = '<';
|
|
10
11
|
var PROTOTYPE = 'prototype';
|
|
11
|
-
var
|
|
12
|
+
var SCRIPT = 'script';
|
|
13
|
+
var IE_PROTO = sharedKey('IE_PROTO');
|
|
14
|
+
|
|
15
|
+
var EmptyConstructor = function () { /* empty */ };
|
|
16
|
+
|
|
17
|
+
var scriptTag = function (content) {
|
|
18
|
+
return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Create object with fake `null` prototype: use ActiveX Object with cleared prototype
|
|
22
|
+
var NullProtoObjectViaActiveX = function (activeXDocument) {
|
|
23
|
+
activeXDocument.write(scriptTag(''));
|
|
24
|
+
activeXDocument.close();
|
|
25
|
+
var temp = activeXDocument.parentWindow.Object;
|
|
26
|
+
activeXDocument = null; // avoid memory leak
|
|
27
|
+
return temp;
|
|
28
|
+
};
|
|
12
29
|
|
|
13
30
|
// Create object with fake `null` prototype: use iframe Object with cleared prototype
|
|
14
|
-
var
|
|
31
|
+
var NullProtoObjectViaIFrame = function () {
|
|
15
32
|
// Thrash, waste and sodomy: IE GC bug
|
|
16
33
|
var iframe = documentCreateElement('iframe');
|
|
17
|
-
var
|
|
18
|
-
var lt = '<';
|
|
19
|
-
var script = 'script';
|
|
20
|
-
var gt = '>';
|
|
21
|
-
var js = 'java' + script + ':';
|
|
34
|
+
var JS = 'java' + SCRIPT + ':';
|
|
22
35
|
var iframeDocument;
|
|
23
36
|
iframe.style.display = 'none';
|
|
24
37
|
html.appendChild(iframe);
|
|
25
|
-
|
|
38
|
+
// https://github.com/zloirock/core-js/issues/475
|
|
39
|
+
iframe.src = String(JS);
|
|
26
40
|
iframeDocument = iframe.contentWindow.document;
|
|
27
41
|
iframeDocument.open();
|
|
28
|
-
iframeDocument.write(
|
|
42
|
+
iframeDocument.write(scriptTag('document.F=Object'));
|
|
29
43
|
iframeDocument.close();
|
|
30
|
-
|
|
31
|
-
while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
|
32
|
-
return createDict();
|
|
44
|
+
return iframeDocument.F;
|
|
33
45
|
};
|
|
34
46
|
|
|
47
|
+
// Check for document.domain and active x support
|
|
48
|
+
// No need to use active x approach when document.domain is not set
|
|
49
|
+
// see https://github.com/es-shims/es5-shim/issues/150
|
|
50
|
+
// variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
|
|
51
|
+
// avoid IE GC bug
|
|
52
|
+
var activeXDocument;
|
|
53
|
+
var NullProtoObject = function () {
|
|
54
|
+
try {
|
|
55
|
+
/* global ActiveXObject */
|
|
56
|
+
activeXDocument = document.domain && new ActiveXObject('htmlfile');
|
|
57
|
+
} catch (error) { /* ignore */ }
|
|
58
|
+
NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
|
|
59
|
+
var length = enumBugKeys.length;
|
|
60
|
+
while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
|
|
61
|
+
return NullProtoObject();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
hiddenKeys[IE_PROTO] = true;
|
|
65
|
+
|
|
35
66
|
// `Object.create` method
|
|
36
67
|
// https://tc39.github.io/ecma262/#sec-object.create
|
|
37
68
|
module.exports = Object.create || function create(O, Properties) {
|
|
38
69
|
var result;
|
|
39
70
|
if (O !== null) {
|
|
40
|
-
|
|
41
|
-
result = new
|
|
42
|
-
|
|
71
|
+
EmptyConstructor[PROTOTYPE] = anObject(O);
|
|
72
|
+
result = new EmptyConstructor();
|
|
73
|
+
EmptyConstructor[PROTOTYPE] = null;
|
|
43
74
|
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
44
75
|
result[IE_PROTO] = O;
|
|
45
|
-
} else result =
|
|
76
|
+
} else result = NullProtoObject();
|
|
46
77
|
return Properties === undefined ? result : defineProperties(result, Properties);
|
|
47
78
|
};
|
|
48
|
-
|
|
49
|
-
hiddenKeys[IE_PROTO] = true;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var InternalStateModule = require('../internals/internal-state');
|
|
3
|
+
var createIteratorConstructor = require('../internals/create-iterator-constructor');
|
|
4
|
+
var has = require('../internals/has');
|
|
5
|
+
var objectKeys = require('../internals/object-keys');
|
|
6
|
+
var toObject = require('../internals/to-object');
|
|
7
|
+
|
|
8
|
+
var OBJECT_ITERATOR = 'Object Iterator';
|
|
9
|
+
var setInternalState = InternalStateModule.set;
|
|
10
|
+
var getInternalState = InternalStateModule.getterFor(OBJECT_ITERATOR);
|
|
11
|
+
|
|
12
|
+
module.exports = createIteratorConstructor(function ObjectIterator(source, mode) {
|
|
13
|
+
var object = toObject(source);
|
|
14
|
+
setInternalState(this, {
|
|
15
|
+
type: OBJECT_ITERATOR,
|
|
16
|
+
mode: mode,
|
|
17
|
+
object: object,
|
|
18
|
+
keys: objectKeys(object),
|
|
19
|
+
index: 0
|
|
20
|
+
});
|
|
21
|
+
}, 'Object', function next() {
|
|
22
|
+
var state = getInternalState(this);
|
|
23
|
+
var keys = state.keys;
|
|
24
|
+
while (true) {
|
|
25
|
+
if (keys === null || state.index >= keys.length) {
|
|
26
|
+
state.object = state.keys = null;
|
|
27
|
+
return { value: undefined, done: true };
|
|
28
|
+
}
|
|
29
|
+
var key = keys[state.index++];
|
|
30
|
+
var object = state.object;
|
|
31
|
+
if (!has(object, key)) continue;
|
|
32
|
+
switch (state.mode) {
|
|
33
|
+
case 'keys': return { value: key, done: false };
|
|
34
|
+
case 'values': return { value: object[key], done: false };
|
|
35
|
+
} /* entries */ return { value: [key, object[key]], done: false };
|
|
36
|
+
}
|
|
37
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty
|
package/internals/shared.js
CHANGED
|
@@ -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.
|
|
7
|
+
version: '3.6.0',
|
|
8
8
|
mode: IS_PURE ? 'pure' : 'global',
|
|
9
9
|
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
|
10
10
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
// empty
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var $ = require('../internals/export');
|
|
3
|
+
var ObjectIterator = require('../internals/object-iterator');
|
|
4
|
+
|
|
5
|
+
// `Object.iterateEntries` method
|
|
6
|
+
// https://github.com/tc39/proposal-object-iteration
|
|
7
|
+
$({ target: 'Object', stat: true }, {
|
|
8
|
+
iterateEntries: function iterateEntries(object) {
|
|
9
|
+
return new ObjectIterator(object, 'entries');
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var $ = require('../internals/export');
|
|
3
|
+
var ObjectIterator = require('../internals/object-iterator');
|
|
4
|
+
|
|
5
|
+
// `Object.iterateKeys` method
|
|
6
|
+
// https://github.com/tc39/proposal-object-iteration
|
|
7
|
+
$({ target: 'Object', stat: true }, {
|
|
8
|
+
iterateKeys: function iterateKeys(object) {
|
|
9
|
+
return new ObjectIterator(object, 'keys');
|
|
10
|
+
}
|
|
11
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var $ = require('../internals/export');
|
|
3
|
+
var ObjectIterator = require('../internals/object-iterator');
|
|
4
|
+
|
|
5
|
+
// `Object.iterateValues` method
|
|
6
|
+
// https://github.com/tc39/proposal-object-iteration
|
|
7
|
+
$({ target: 'Object', stat: true }, {
|
|
8
|
+
iterateValues: function iterateValues(object) {
|
|
9
|
+
return new ObjectIterator(object, 'values');
|
|
10
|
+
}
|
|
11
|
+
});
|
package/package.json
CHANGED
package/stage/1.js
CHANGED
|
@@ -5,6 +5,7 @@ require('../proposals/keys-composition');
|
|
|
5
5
|
require('../proposals/math-extensions');
|
|
6
6
|
require('../proposals/math-signbit');
|
|
7
7
|
require('../proposals/number-from-string');
|
|
8
|
+
require('../proposals/object-iteration');
|
|
8
9
|
require('../proposals/observable');
|
|
9
10
|
require('../proposals/pattern-matching');
|
|
10
11
|
require('../proposals/promise-try');
|