-
Notifications
You must be signed in to change notification settings - Fork 55
Add lastIndexOf() function #1087
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
Add lastIndexOf() function #1087
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds the lastIndexOf() function to DSC, which returns the index of the last occurrence of an item in an array. The function supports searching for strings, numbers, arrays, and objects with deep equality comparison, returning -1 if no match is found.
- Implements the
LastIndexOfstruct with proper metadata and invoke logic using Rust'srposition()method - Adds comprehensive test coverage for various data types including strings, numbers, arrays, and objects
- Includes localization support and comprehensive documentation with practical examples
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| dsc_lib/src/functions/mod.rs | Registers the new last_index_of module and LastIndexOf function |
| dsc_lib/src/functions/last_index_of.rs | Core implementation with metadata, invoke logic, and comprehensive tests |
| dsc_lib/locales/en-us.toml | Localization strings for the function description and error messages |
| dsc/tests/dsc_functions.tests.ps1 | PowerShell integration tests covering various use cases |
| docs/reference/schemas/config/functions/lastIndexOf.md | Complete reference documentation with examples and parameter details |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
7d51512 to
ea85b32
Compare
…n/operation-methods into add-lastindexof-function
PR Summary
This pull request adds the lastIndexOf() function, including reference documentation.
PR Context
Partially addresses #57