gpt4 book ai didi

javascript - 无法解析错误 - 出了什么问题?

转载 作者:行者123 更新时间:2023-12-03 07:08:12 25 4
gpt4 key购买 nike

这是带有“无法解析错误”的行 -> var label = package.getComment() && package.getComment() : 'N/A'

其余代码... var script = '/home/paulomacedo/jd2/JD_HOME/jdownloader-postprocess.sh'

var path = package.getDownloadFolder() 
var name = package.getName()
var label = package.getComment() && package.getComment() : 'N/A'
var links = package.getDownloadLinks() ? package.getDownloadLinks() : []

function isReallyFinished() {
for (var i = 0; i < links.length; i++) {
if (links[i].getArchive() != null && links[i].getExtractionStatus() != "SUCCESSFUL" || !package.isFinished()) {
return false
}
}
return true
}

if (isReallyFinished()) {
var command = [script, path, name, label, 'PACKAGE_FINISHED']
log(command)
log(callSync(command))
}

最佳答案

错误在这里:

var label = package.getComment() && package.getComment() : 'N/A' 
// ^

您确实想使用 ternary operator :

var label = package.getComment() ? package.getComment() : 'N/A' 

a && b || c:

var label = package.getComment() && package.getComment() || 'N/A' 

关于javascript - 无法解析错误 - 出了什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36720313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com