Skip to content

Commit

Permalink
Fix mislabelled polyfills for Object.entries and Object.values (#31880)
Browse files Browse the repository at this point in the history
Summary:
The polyfills for `Object.entries` and `Object.values` are in a file named `Object.es7.js` when these APIs form part of ES8/ES2017 (https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_–_ECMAScript_2017).

The docs (https://reactnative.dev/docs/javascript-environment#polyfills) list these correctly as ES8 so I thought it might reduce confusion if anyone starts looking into the polyfills in the future like I did.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Fix filename to include correct ECMA spec

Pull Request resolved: #31880

Test Plan: All unit tests pass.

Reviewed By: yungsters

Differential Revision: D29820165

Pulled By: ShikaSD

fbshipit-source-id: 2a4eb58bed7b7a4089406665c5c9115cb1773ff6
  • Loading branch information
sheepsteak authored and facebook-github-bot committed Jul 21, 2021
1 parent d9e0ea7 commit 8a62583
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
const MockNativeMethods = jest.requireActual('./MockNativeMethods');
const mockComponent = jest.requireActual('./mockComponent');

jest.requireActual('@react-native/polyfills/Object.es7');
jest.requireActual('@react-native/polyfills/Object.es8');
jest.requireActual('@react-native/polyfills/error-guard');

global.__DEV__ = true;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

'use strict';

describe('Object (ES7)', () => {
describe('Object (ES8)', () => {
beforeEach(() => {
delete Object.entries;
delete Object.values;
jest.resetModules();
require('../Object.es7');
require('../Object.es8');
});

describe('Object.entries', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/polyfills/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
module.exports = () => [
require.resolve('./console.js'),
require.resolve('./error-guard.js'),
require.resolve('./Object.es7.js'),
require.resolve('./Object.es8.js'),
];

0 comments on commit 8a62583

Please sign in to comment.