Let safely() support Arrays
This commit is contained in:
parent
f394b75f38
commit
297002fec4
1 changed files with 6 additions and 2 deletions
|
@ -68,8 +68,12 @@ class script extends utils {
|
||||||
return JSON.stringify(o)
|
return JSON.stringify(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
static safely (s) {
|
static safely (obj) {
|
||||||
return `try { ${s} } catch(e) { }`
|
if (Array.isArray(obj)) {
|
||||||
|
return obj.map(s => utils.script.safely(s)).join(' ')
|
||||||
|
} else {
|
||||||
|
return `try { ${obj} } catch(e) { }`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static makeLoop (s, max) {
|
static makeLoop (s, max) {
|
||||||
|
|
Loading…
Reference in a new issue