diff --git a/js/common/bootstrap/modules/internal.js b/js/common/bootstrap/modules/internal.js index aad7e1c2a6..6ece8e5078 100644 --- a/js/common/bootstrap/modules/internal.js +++ b/js/common/bootstrap/modules/internal.js @@ -1726,6 +1726,10 @@ if (typeof SYS_OPTIONS !== 'undefined') { delete global.SYS_OPTIONS; } +exports.propertyKeys = (obj) => Object.keys(obj).filter((key) => { + return (key.charAt(0) !== '_' && key.charAt(0) !== '$'); +}); + //////////////////////////////////////////////////////////////////////////////// /// @brief print diff --git a/js/common/bootstrap/monkeypatches.js b/js/common/bootstrap/monkeypatches.js index 78d2e70b57..3b2cb12833 100644 --- a/js/common/bootstrap/monkeypatches.js +++ b/js/common/bootstrap/monkeypatches.js @@ -38,26 +38,12 @@ Object.defineProperty(Object.prototype, '_shallowCopy', { get() { - var self = this; - return this.propertyKeys.reduce(function (previous, key) { - previous[key] = self[key]; + return require('internal').propertyKeys(this).reduce((previous, key) => { + previous[key] = this[key]; return previous; }, {}); } }); -//////////////////////////////////////////////////////////////////////////////// -/// @brief returns the property keys -//////////////////////////////////////////////////////////////////////////////// - -Object.defineProperty(Object.prototype, 'propertyKeys', { - get() { - return Object.keys(this).filter(function (key) { - return (key.charAt(0) !== '_' && key.charAt(0) !== '$'); - }); - } -}); - - }()); diff --git a/js/common/modules/@arangodb/graph-common.js b/js/common/modules/@arangodb/graph-common.js index 9ea7fb619c..b7b7ca848a 100644 --- a/js/common/modules/@arangodb/graph-common.js +++ b/js/common/modules/@arangodb/graph-common.js @@ -28,6 +28,7 @@ //////////////////////////////////////////////////////////////////////////////// var is = require("@arangodb/is"), + internal = require("internal"), Edge, Graph, Vertex, @@ -244,7 +245,7 @@ Edge.prototype.getProperty = function (name) { //////////////////////////////////////////////////////////////////////////////// Edge.prototype.getPropertyKeys = function () { - return this._properties.propertyKeys; + return internal.propertyKeys(this._properties); }; //////////////////////////////////////////////////////////////////////////////// @@ -431,7 +432,7 @@ Vertex.prototype.getProperty = function (name) { //////////////////////////////////////////////////////////////////////////////// Vertex.prototype.getPropertyKeys = function () { - return this._properties.propertyKeys; + return internal.propertyKeys(this._properties); }; ////////////////////////////////////////////////////////////////////////////////