在我的 lambda 函数中,它接受事件 api 查询字符串,我想检查是否存在。如果是下面的工作:
if event['queryStringParameters']['order'] == 'desc':
file_names.append('hello')
Run Code Online (Sandbox Code Playgroud)
我试过,event['queryStringParameters']['order'] != null
但如果没有使用 lambda 函数的订单查询字符串,该函数会中断,导致 502 响应。如何在不中断的情况下检查查询字符串是否未被使用?
我有一个对象数组:
[
{
SalePrice:"18000",
TotalValue:"22500"
ratio:1.25
}
{
SalePrice:"128000",
TotalValue:"212500"
ratio:1.05
}
]
Run Code Online (Sandbox Code Playgroud)
我想把它组成一个数组。喜欢:
[
[18000, 22500, 1.25],
[128000, 212500, 1.05]
]
Run Code Online (Sandbox Code Playgroud)
使用 JS(ES6 可以)。我试过使用类似的东西:
let array = data.map(({SalePrice, TotalValue, ratio}) => SalePrice, TotalValue, ratio).filter(s => s, t = >t, r => r);
Run Code Online (Sandbox Code Playgroud)
但这不起作用,有人可以启发我吗?