diff --git a/lib/utils/script.js b/lib/utils/script.js index f245d5d..4070d3d 100644 --- a/lib/utils/script.js +++ b/lib/utils/script.js @@ -58,8 +58,12 @@ utils.script = { } return JSON.stringify(o) }, - safely: function (s) { - return 'try { ' + s + ' } catch(e) { }' + safely: function (obj) { + if (Array.isArray(obj)) { + return obj.map(s => utils.script.safely(s)).join(' ') + } else { + return `try { ${obj} } catch(e) { }` + } }, makeLoop: function (s, max) { return 'for (let i = 0; i < ' + (max || make.number.range()) + '; i++) {' + s + '}'