Skip to content

Commit

Permalink
Add Object.entries polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnwalraven committed Aug 11, 2018
1 parent 2369b06 commit fec517d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/apollo-server-env/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import './polyfills/Object.values';
import './polyfills/Object.entries';

require('util.promisify').shim();

Expand Down
5 changes: 5 additions & 0 deletions packages/apollo-server-env/src/polyfills/Object.entries.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if (!global.Object.entries) {
global.Object.entries = function(object: any) {
return Object.keys(object).map(key => [key, object[key]] as [string, any]);
};
}
4 changes: 2 additions & 2 deletions packages/apollo-server-env/src/polyfills/Object.values.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
if (!global.Object.values) {
global.Object.values = function(o: any) {
return Object.keys(o).map(key => o[key]);
global.Object.values = function(object: any) {
return Object.keys(object).map(key => object[key]);
};
}

0 comments on commit fec517d

Please sign in to comment.