I want to filter over a collection of items with an eventual wildcard.
Let's say, I have the following items:
const items = ['Banana', 'Apple', 'Melon']
I now want to filter with the following strings:
e
Expected output: None
*e
Expected output: Apple
*e*
Expected output: Apple, Melon
ana
Expected output: None
*ana
Expected output: Banana
*an
Expected output: none
*an*
Expected output: Banana
I hope you get my intention. Is there any smart way to do it with regex or standard JS functions / libraries? I couldn't find something so far.