1
有一個在我的代碼promice:解構promice回調
req.getValidationResult()
.then(result => {
let errors = result.array();
if (errors.length) {
return res.status(400).json({ errors: errors });
}
return next();
});
我想知道是否有任何變種,以解構我的「結果」變量上,然後調用(像.then({result.array(): errors} =>...
),而不是使let errors = result.array();
分配。