为什么这总是返回false?
var dependsOn = {
"Cadastro": {
"RHID": "RHID"
},
"Agregados": {
"CD_DOC": "CD_DOC"
},
"Documentos": {
"RHID": "CD_DOC"
}
}
var field = 'RHID'
_.mapKeys(dependsOn, function(value, key) {
if (_.some(dependsOn[key], function(o) {
return _.has(o, field);
})) {
console.log(key);
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
答案 0 :(得分:0)
_.findKey(dependsOn, field); //