I have a array of objects.
hope you get the idea with this picture.
getCondition: function(type, processParam) {
var filter;
if(type == "description") {
console.log("_dgnConditions",_dgnConditions);
filter = _dgnConditions.filter((condition)=>condition.description == 'string' && item.indexOf(processParam) > -1);
}
return filter.length ? filter[0] : null;
},
Im trying to find string partials in this massive array using the above code, but I get no results.
partial example would be facial bones
for instance (of the picture)
EDIT
filter = _dgnConditions.filter((condition)=>condition.description == condition.description.indexOf(processParam) > -1);
try:-
getCondition: function(type, processParam) {
var filter;
if(type == "description") {
console.log("_dgnConditions",_dgnConditions);
filter = _dgnConditions.filter((condition)=> typeof condition.description == 'string' && condition.description.indexOf(processParam) > -1);
}
return filter.length ? filter[0] : null;
},
as condition.description == 'string'
will not check the type. and you are looking for the index of processParam
inside the description.
not sure where item
is coming from.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.