Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

docs(filter): clarify the comparator parameter #15827

Closed
wants to merge 3 commits into from
Closed

docs(filter): clarify the comparator parameter #15827

wants to merge 3 commits into from

Conversation

fcostarodrigo
Copy link
Contributor

@fcostarodrigo fcostarodrigo commented Mar 17, 2017

The previous description does not make it clear how this parameter is used with other parameters
and its purpose.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

This is a doc update.

What is the current behavior? (You can also link to an open issue here)

N/A

What is the new behavior (if this is a feature change)?

N/A

Does this PR introduce a breaking change?

This PR does not introduce a breaking change.

Please check if the PR fulfills these requirements

Other information:

The previous description does not make it clear how this parameter is used with other parameters and its purpose.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@fcostarodrigo
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

* the object in the array) should be considered a match.
* @param {function(actual, expected)|true|false} [comparator] A predicate to further refine the
* search results of an object or string expression. It should be used to determine if the
* actual value from the array is equal to the expected value from the filter expression.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH, I feel this change is more confusing. E.g. comparator is not used to "further refine the search results". And "should be used" sounds more like the user should do something (vs AngularJS using the function under the hood). And also actual is not necessarily a "value from the array", but can be a property or sub-property of an item in the collection/array.

@@ -45,8 +45,9 @@
* The final result is an array of those elements that the predicate returned true for.
*
* @param {function(actual, expected)|true|false} [comparator] Comparator which is used in
* determining if the expected value (from the filter expression) and actual value (from
* the object in the array) should be considered a match.
* determining if matches returned by the argument expression should be considered a match based
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matches are not returned by the expression argument. How about something like:

determining if values retrieved using expression should be...

Explain that comparator is only called when expression is not a function.
@gkalpak gkalpak closed this in b9d2b30 Mar 23, 2017
gkalpak pushed a commit that referenced this pull request Mar 23, 2017
@fcostarodrigo fcostarodrigo deleted the patch-1 branch March 24, 2017 11:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants