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

Example of how to use indexSearch? #149

Open
filburt-turle opened this issue Nov 15, 2020 · 2 comments
Open

Example of how to use indexSearch? #149

filburt-turle opened this issue Nov 15, 2020 · 2 comments

Comments

@filburt-turle
Copy link

indexSearch: (searchTerm: string, nodes: FlattenedNode[]) => (node: FlattenedNode) => boolean;

I see the structure, but I'm wondering if someone could provide an example of a baseline version of a custom function for this prop. There's no documentation around how to use this I see the final result from this function is a boolean, but an example would clarify this better for me.

Thanks in advanced.

@ldeveber
Copy link

I'm also a bit confused on this. I saw it was marked as required, but I have no idea what it wants for an implementation. Any guidance here?

@Karpengold
Copy link

const indexByName = searchTerm => ({name}) => {
  const upperCaseName = name.toUpperCase();
  const upperCaseSearchTerm = searchTerm.toUpperCase();

  return upperCaseName.indexOf(upperCaseSearchTerm.trim()) > -1;
};

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

3 participants