Skip to content

Commit

Permalink
runtime: polyfill Object.values()
Browse files Browse the repository at this point in the history
Minimum supported Node version is 6.9.0, but Object.values() was introduced in
Node < 7. Let's use a polyfill if needed.

This will be removed when minimum supported Node version is raised to 8.9.0.

Fixes #3459
  • Loading branch information
muxator committed Aug 15, 2018
1 parent 7a6d969 commit fc14f60
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/node/stats.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* TODO: this polyfill is needed for Node 6.9 support.
*
* Once minimum supported Node version is raised to 8.9.0, it will be removed.
*/
if (!Object.values) {
var log4js = require('log4js');
var statsLogger = log4js.getLogger("stats");

statsLogger.warn(`Enabling a polyfill to run on this Node version (${process.version}). Next Etherpad version will remove support for Node version < 8.9.0. Please update your runtime.`);

var values = require('object.values');

values.shim();
}

var measured = require('measured-core')

module.exports = measured.createCollection();
1 change: 1 addition & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"log4js": "0.6.35",
"measured-core": "1.11.2",
"npm": ">=4.0.2",
"object.values": "^1.0.4",
"request": "2.83.0",
"resolve": "1.1.7",
"security": "1.0.0",
Expand Down

0 comments on commit fc14f60

Please sign in to comment.