javascript - 如何在 express-validator 中访问自定义通配符验证中的对象
问题描述
我想在自定义通配符验证中访问对象
body('inputs.*.minimum')
.custom((value, { req, path }) => {
const maxValue = body('inputs.*').maximum
return Number(value) <= Number(maxValue)
})
.withMessage('error message'),
我尝试使用上述方法但无法获得maxValue
。
我也发现了这个,但不想使用lodash
库
解决方案
推荐阅读
- c# - 如何解决 C# 中的“Range.Find Return null”问题?
- ruby-on-rails - 出现属性未更新但未回滚
- php - 我想从数据库中获取 id 值
- powershell - 替换 Powershell V5 中的命令?
- python - 如何创建一个创建子列表并向其中添加元素的循环
- java - 将日期和时间转换为时间戳格式 java "2019-02-21T14:10:18.161+0000"
- scala - 我在 JMC/JFR 中看到的 `$adapted$` 方法是什么?
- neo4j - 使用 Cypher 查找关联
- angular - 无法在 iis 服务器上显示 Blob 图像
- javascript - 如何在我的网站上显示与嵌入视频的经过时间同步的计时器