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

Update api.md #287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Update api.md #287

wants to merge 1 commit into from

Conversation

buom
Copy link

@buom buom commented Mar 8, 2023

correct the default filter

correct the default filter
Copy link
Collaborator

@larsga larsga left a comment

Choose a reason for hiding this comment

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

Thank you for fixing the wrong method call in the documentation. That's much appreciated! 👍

Unfortunately, the other suggested change is wrong (see detail comment). If you can remove that I'll merge the PR.

```

The filter can be either a string containing JSLT. The JSLT expression
needs to return `true` for the object values that should be included.
So to get the default behaviour you would set the filter to:

```
. == null or . == {} or . == []
. == null or . == {} or . == [] or not(.) == false
Copy link
Collaborator

Choose a reason for hiding this comment

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

This addition is not correct. As you can see here it really is null, {}, and [] that are the omitted values.

The suggested change would, for example, filter out true, and 5, and so on.

Copy link
Author

Choose a reason for hiding this comment

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

@larsga Here we have two different implementations:

  1. Default implementation: NodeUtils.isValue(value); - here
  2. Custom implementation: NodeUtils.isTrue(jslt.apply(value)); - here

NodeUtils.isValue(value) != NodeUtils.isTrue(value)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, that's true, but the example expression says how to reproduce the default behaviour, which is your number 1.

@larsga larsga self-assigned this Mar 8, 2023
@larsga larsga added the bug Something isn't working label Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants