Skip to content

Commit de20232

Browse files
committed
Object.keys polyfill
1 parent ab1ebbd commit de20232

File tree

18 files changed

+47
-22
lines changed

18 files changed

+47
-22
lines changed

packages/babel-plugin-polyfill-es-shims/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ This plugin supports the following `es-shims` polyfills.
4343
| `Array.prototype.reduce` | [`array.prototype.reduce`](https://github.com/es-shims/Array.prototype.reduce) |
4444
| `Array.prototype.reduceRight` | [`array.prototype.reduceright`](https://github.com/es-shims/Array.prototype.reduceRight) |
4545
| `Array.prototype.some` | [`array.prototype.some`](https://github.com/es-shims/Array.prototype.some) |
46+
| `Object.keys` | [`object.keys`](https://github.com/ljharb/object-keys) | [@ljharb](https://github.com/ljharb)
4647
| `String.prototype.split` | [`string.prototype.split`](https://github.com/es-shims/String.prototype.split) |
4748

4849
### ES2015 (ES6)

packages/babel-plugin-polyfill-es-shims/data/polyfills.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,20 @@
290290
"samsung": "11",
291291
"electron": "5"
292292
},
293+
"Object.keys": {
294+
"chrome": "5",
295+
"opera": "12",
296+
"edge": "12",
297+
"firefox": "4",
298+
"safari": "4",
299+
"node": "0.10",
300+
"ie": "9",
301+
"android": "4",
302+
"ios": "6",
303+
"phantom": "2",
304+
"samsung": "1",
305+
"electron": "0.20"
306+
},
293307
"Object.getOwnPropertyDescriptors": {
294308
"chrome": "54",
295309
"opera": "41",

packages/babel-plugin-polyfill-es-shims/missing-polyfills.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
- `Array.prototype.copyWithin()`
2121
- `Array.prototype.fill()`
2222
- `Array.prototype.indexOf()`
23-
- `Object.keys()`
2423
- `Object.setPrototypeOf()`
2524
- `Math.acosh()`
2625
- `Math.asinh()`

packages/babel-plugin-polyfill-es-shims/src/mappings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ defineStatic("Object", "assign", "4.1.0");
7272
defineStatic("Object", "entries", "1.1.1");
7373
defineStatic("Object", "fromEntries", "2.0.2");
7474
defineStatic("Object", "is", "1.1.2", "object-is");
75+
defineStatic("Object", "keys", "1.1.1", "object-keys");
7576
defineStatic("Object", "getOwnPropertyDescriptors", "2.1.0");
7677
defineStatic("Object", "values", "1.1.1");
7778

packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-global/conflict-static-instance-1/output.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import "object.entries/auto";
2+
import "object-keys/auto";
23
import "object.values/auto";
34
Object.entries();
45
Object.keys();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Some polyfills have been added but are not present in your dependencies.
22
Please run one of the following commands:
3-
npm install --save object.entries@^1.1.1 object.values@^1.1.1
4-
yarn add object.entries@^1.1.1 object.values@^1.1.1
3+
npm install --save object-keys@^1.1.1 object.entries@^1.1.1 object.values@^1.1.1
4+
yarn add object-keys@^1.1.1 object.entries@^1.1.1 object.values@^1.1.1

packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-global/static-methods/output.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "object-keys/auto";
12
import "object.assign/auto";
23
Object.keys(foo);
34
const getOwnPropertySymbols = Object.getOwnPropertySymbols;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Some polyfills have been added but are not present in your dependencies.
22
Please run one of the following commands:
3-
npm install --save object.assign@^4.1.0
4-
yarn add object.assign@^4.1.0
3+
npm install --save object-keys@^1.1.1 object.assign@^4.1.0
4+
yarn add object-keys@^1.1.1 object.assign@^4.1.0

packages/babel-plugin-polyfill-es-shims/test/fixtures/usage-pure/conflict-static-instance/output.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var _obj, _obj2, _obj3, _str;
22

33
import _ObjectEntries from "object.entries";
44
import _ArrayPrototypeEntries from "array.prototype.entries";
5+
import _ObjectKeys from "object-keys";
56
import _ArrayPrototypeKeys from "array.prototype.keys";
67
import _ObjectValues from "object.values";
78
import _ArrayPrototypeValues from "array.prototype.values";
@@ -13,7 +14,8 @@ _ObjectEntries();
1314

1415
_ArrayPrototypeEntries([]);
1516

16-
Object.keys();
17+
_ObjectKeys();
18+
1719
(_obj2 = obj, Array.isArray(_obj2) ? _ArrayPrototypeKeys : Function.call.bind(_obj2.keys))(_obj2);
1820

1921
_ArrayPrototypeKeys([]);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Some polyfills have been added but are not present in your dependencies.
22
Please run one of the following commands:
3-
npm install --save array.prototype.entries@^1.0.0 array.prototype.keys@^1.0.0 array.prototype.values@^1.0.0 object.entries@^1.1.1 object.values@^1.1.1 string.prototype.split@^1.0.1
4-
yarn add array.prototype.entries@^1.0.0 array.prototype.keys@^1.0.0 array.prototype.values@^1.0.0 object.entries@^1.1.1 object.values@^1.1.1 string.prototype.split@^1.0.1
3+
npm install --save array.prototype.entries@^1.0.0 array.prototype.keys@^1.0.0 array.prototype.values@^1.0.0 object-keys@^1.1.1 object.entries@^1.1.1 object.values@^1.1.1 string.prototype.split@^1.0.1
4+
yarn add array.prototype.entries@^1.0.0 array.prototype.keys@^1.0.0 array.prototype.values@^1.0.0 object-keys@^1.1.1 object.entries@^1.1.1 object.values@^1.1.1 string.prototype.split@^1.0.1

0 commit comments

Comments
 (0)