Replace getKeysFromHash with Object.keys

This commit is contained in:
pyoor 2018-09-04 14:22:19 -04:00
parent f4982dc303
commit 7149e2af12
2 changed files with 5 additions and 6 deletions

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const random = require('../random') const random = require('../random')
const utils = require('../utils')
const logger = require('../logging') const logger = require('../logging')
var o = null // eslint-disable-line no-unused-vars var o = null // eslint-disable-line no-unused-vars
@ -49,7 +48,7 @@ class Objects {
pop (objectName) { pop (objectName) {
let self = this let self = this
utils.common.getKeysFromHash(this.container).forEach(function (category) { Object.keys(this.container).forEach(function (category) {
self.container[category].forEach(function (obj) { self.container[category].forEach(function (obj) {
if (obj.name === objectName) { if (obj.name === objectName) {
self.container[category].splice(self.container[category].indexOf(obj), 1) self.container[category].splice(self.container[category].indexOf(obj), 1)
@ -88,10 +87,10 @@ class Objects {
valid () { valid () {
let items = [] let items = []
let self = this let self = this
utils.common.getKeysFromHash(self.container).forEach(function (category) { Object.keys(self.container).forEach(function (category) {
self.check(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++) { for (let i = 0; i < self.container[category].length; i++) {
items.push(self.container[category][i].name) items.push(self.container[category][i].name)
} }

View file

@ -56,7 +56,7 @@ class script extends utils {
} }
static methodCall (objectName, methodHash) { static methodCall (objectName, methodHash) {
if (!utils.common.getKeysFromHash(methodHash).length || !objectName) { if (!Object.keys(methodHash).length || !objectName) {
return '' return ''
} }
let methodName = random.key(methodHash) let methodName = random.key(methodHash)
@ -115,7 +115,7 @@ class script extends utils {
} }
static setAttribute (objectName, attributeHash) { static setAttribute (objectName, attributeHash) {
if (!utils.common.getKeysFromHash(attributeHash).length || !objectName) { if (!Object.keys(attributeHash).length || !objectName) {
return '' return ''
} }
let attributeName = random.key(attributeHash) let attributeName = random.key(attributeHash)