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

Implement indices, index and rindex. #158

Merged
merged 1 commit into from
Mar 11, 2024

Conversation

kklingenberg
Copy link
Contributor

@kklingenberg kklingenberg commented Feb 4, 2024

This PR implements indices and copies jq's derivative implementations of index and rindex according to the spec here. Note that jq has TODO's related to performance on said implementations, so perhaps you'd want to close this PR and wait for a performant version of these filters.

Also, the behaviour of jq's indices varies slightly when dealing with strings. I reported/asked about it here: jqlang/jq#3030 (my mistake; jq solved the issue in 1.7)

Closes #154

@01mf02 01mf02 merged commit 99cf12f into 01mf02:main Mar 11, 2024
1 check passed
@01mf02
Copy link
Owner

01mf02 commented Mar 11, 2024

Thanks a lot, this is some great work! Just for future reference, in tests, it is preferable to use yields! instead of gives, because it allows for much more compact tests with names.

@kklingenberg kklingenberg deleted the feature/indices branch March 11, 2024 16:56
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

Successfully merging this pull request may close these issues.

Support JQ's index/rindex function
2 participants