Replace getKeysFromHash with Object.keys
This commit is contained in:
parent
f4982dc303
commit
7149e2af12
2 changed files with 5 additions and 6 deletions
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue