Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Pass an Array into extract #14

Open
Amerlander opened this issue Feb 21, 2021 · 0 comments
Open

[Feature request] Pass an Array into extract #14

Amerlander opened this issue Feb 21, 2021 · 0 comments

Comments

@Amerlander
Copy link
Contributor

Amerlander commented Feb 21, 2021

I think about having a title and a subtilte, which should both be searched but have different formatting.

of course I can do const extract = (item) => ' <h3>' + item.title+ '</h3><p>'+item.subtitle+'</p>':

But searching for h3 would find (and crash) the html:

image

So I thought about passing an array into extract and geting an array in result.string back:

const extract = (item) => [ item.title, item.subtitle ];
 <Typeahead {data} {extract}>
        <div>
           <h3> {result.string[0]}</h3>
           <h3> {result.string[1]}</h3>
        </div>
    </Typeahead>

What do you think about that Idea?
To not break things it would be nice to have the ability to pass in an array or a string.

I think this would also need some changes in fuzzy.js, but I dind't looked much into it and thought I'll ask you first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant