Answer the question
In order to leave comments, you need to log in
How to add a method to an object property if the property name consists of two words?
I have this line:
return data.filter(n => n.dori.toLowerCase().includes(search));
dori
is a property of the object carColorID.code
Answer the question
In order to leave comments, you need to log in
Partial search (any occurrence of the substring search in the string carColorId.code ):
export function searchFilter(search, data) {
return data.filter(n => n.carColorId.code.toLowerCase().includes(search));
}
export function searchFilter(search, data) {
let pattern = new RegExp("^"+search, "i");
return data.filter( n=> pattern.test(n.carColorId.code) );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question