Skip to content

Commit

Permalink
Use Object.fromEntries()
Browse files Browse the repository at this point in the history
  • Loading branch information
minznerjosh committed Jan 8, 2019
1 parent 7290dd8 commit eb0819e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/enzyme-adapter-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"dependencies": {
"function.prototype.name": "^1.1.0",
"object.assign": "^4.1.0",
"object.fromentries": "^2.0.0",
"prop-types": "^15.6.2",
"semver": "^5.6.0"
},
Expand Down
7 changes: 2 additions & 5 deletions packages/enzyme-adapter-utils/src/Utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import functionName from 'function.prototype.name';
import fromEntries from 'object.fromentries';
import createMountWrapper from './createMountWrapper';
import createRenderWrapper from './createRenderWrapper';
import wrap from './wrapWithSimpleWrapper';
Expand Down Expand Up @@ -284,9 +285,5 @@ export function getMaskedContext(contextTypes, unmaskedContext) {
if (!contextTypes || !unmaskedContext) {
return {};
}
const context = {};
Object.keys(contextTypes).forEach((key) => {
context[key] = unmaskedContext[key];
});
return context;
return fromEntries(Object.keys(contextTypes).map(key => [key, unmaskedContext[key]]));
}

0 comments on commit eb0819e

Please sign in to comment.