import get from "lodash.get";
const x = [
{
value: 1
},
{
value: {
min: undefined,
max: 2
}
}
];
console.log(
"valid: ",
x.every(o => o.value || (get(o, "value.min") && get(o, "value.max")))
);
https://codesandbox.io/s/modest-dijkstra-g42yy
我希望有效为假,但它返回真,尽管 value.min 未定义。这里有什么问题?
jeck猫
相关分类