Merge pull request #3 from MozillaSecurity/es6
Merge branch 'es6' into master
This commit is contained in:
commit
8a978de0d8
1 changed files with 8 additions and 7 deletions
|
@ -87,13 +87,14 @@ class script extends utils {
|
|||
return `${random.number()} % ${o.pick(objName)}.length`
|
||||
}
|
||||
|
||||
static runner (cmds) {
|
||||
/**
|
||||
* Wrap command(s) in setInterval, setTimeout, loop or run directly
|
||||
* @param {Object|String} cmds - Command(s) to be executed
|
||||
* @param {string|string[]} cmds - Command(s) to be executed
|
||||
* @returns {string}
|
||||
*/
|
||||
static runner (cmds) {
|
||||
cmds = (Array.isArray(cmds)) ? cmds : [cmds]
|
||||
cmds = cmds.filter(function (i) { return i !== undefined })
|
||||
cmds = cmds.filter((i) => i !== undefined)
|
||||
if (cmds.length) {
|
||||
if (random.chance(50)) {
|
||||
// Wrap each command in try/catch for use in setInterval, setTimeout, repeater
|
||||
|
@ -106,9 +107,9 @@ class script extends utils {
|
|||
let n = random.number(random.number(30))
|
||||
return `for (let i = 0; i < ${n}; i++) { ${utils.script.safely(cmds)} }`
|
||||
}
|
||||
} else {
|
||||
return cmds
|
||||
}
|
||||
|
||||
return utils.script.safely(cmds)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue