-
Notifications
You must be signed in to change notification settings - Fork 88
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
Conversation
@bschlenk any idea why tests are not passing?
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.
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?
Now that we have fix most of our CI/build issues, we could work on this feature again :)
Want me to rebase?
I forgot I had a PR for this package and deleted my fork 😛
Closing this in favor of #417
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