From 7149e2af12cabf80db325650cb79dbe182bae864 Mon Sep 17 00:00:00 2001 From: pyoor Date: Tue, 4 Sep 2018 14:22:19 -0400 Subject: [PATCH] Replace getKeysFromHash with Object.keys --- lib/utils/objects.js | 7 +++---- lib/utils/script.js | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/utils/objects.js b/lib/utils/objects.js index cbe1388..698a671 100644 --- a/lib/utils/objects.js +++ b/lib/utils/objects.js @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ const random = require('../random') -const utils = require('../utils') const logger = require('../logging') var o = null // eslint-disable-line no-unused-vars @@ -49,7 +48,7 @@ class Objects { pop (objectName) { let self = this - utils.common.getKeysFromHash(this.container).forEach(function (category) { + Object.keys(this.container).forEach(function (category) { self.container[category].forEach(function (obj) { if (obj.name === objectName) { self.container[category].splice(self.container[category].indexOf(obj), 1) @@ -88,10 +87,10 @@ class Objects { valid () { let items = [] let self = this - utils.common.getKeysFromHash(self.container).forEach(function (category) { + Object.keys(self.container).forEach(function (category) { self.check(category) }) - utils.common.getKeysFromHash(self.container).forEach(function (category) { + Object.keys(self.container).forEach(function (category) { for (let i = 0; i < self.container[category].length; i++) { items.push(self.container[category][i].name) } diff --git a/lib/utils/script.js b/lib/utils/script.js index e711b2b..b5f5983 100644 --- a/lib/utils/script.js +++ b/lib/utils/script.js @@ -56,7 +56,7 @@ class script extends utils { } static methodCall (objectName, methodHash) { - if (!utils.common.getKeysFromHash(methodHash).length || !objectName) { + if (!Object.keys(methodHash).length || !objectName) { return '' } let methodName = random.key(methodHash) @@ -115,7 +115,7 @@ class script extends utils { } static setAttribute (objectName, attributeHash) { - if (!utils.common.getKeysFromHash(attributeHash).length || !objectName) { + if (!Object.keys(attributeHash).length || !objectName) { return '' } let attributeName = random.key(attributeHash)