Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: allow filterProps to be a function #333

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

Closed
bschlenk wants to merge 2 commits into algolia:master from bschlenk:filter-by-function
Closed

feat: allow filterProps to be a function #333

bschlenk wants to merge 2 commits into algolia:master from bschlenk:filter-by-function

Conversation

Copy link
Contributor

@bschlenk bschlenk commented Nov 30, 2018

filterProps can now be passed as either an array of strings, or a function that will be called with the props value and key and return false to filter out that prop.

Closes #286

Copy link
Contributor

vvo commented Dec 5, 2018

@bschlenk any idea why tests are not passing?

Copy link
Contributor Author

I'm not sure, the tests pass on my local machine. The test that fails says "The propNameSorter should always move the key and ref keys first", but specifically asserts that key comes before ref. Is that the expected behavior? Something is causing the sort to be unstable.

Copy link
Contributor Author

Now it is failing for some flow checks. I've never used flow, I'm trying to fix it but I keep getting

Error ------ src/formatter/createPropFilter.js:10:19
Cannot call filter because array type [1] is not a function.
 [1] 5│ filter: string[] | ((any, string) => boolean)
 6│ ) {
 7│ if (Array.isArray(filter)) {
 8│ return key => filter.indexOf(key) === -1;
 9│ } else {
 10│ return key => filter(props[key], key);
 11│ }
 12│ }
 13│

I thought flow was supposed to be able to do type refinement based on the Array.isArray check?

Copy link
Collaborator

Now that we have fix most of our CI/build issues, we could work on this feature again :)

Copy link
Contributor Author

Want me to rebase?

Copy link
Contributor Author

I forgot I had a PR for this package and deleted my fork 😛
Closing this in favor of #417

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

API request: filterFunction

AltStyle によって変換されたページ (->オリジナル) /