Skip to content

Conversation

@Gijsreyn
Copy link
Contributor

PR Summary

This pull request adds the lastIndexOf() function, including reference documentation.

PR Context

Partially addresses #57

@SteveL-MSFT SteveL-MSFT requested a review from Copilot August 30, 2025 00:35
Copy link
Contributor

Copilot AI left a 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 LastIndexOf struct with proper metadata and invoke logic using Rust's rposition() 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.

@Gijsreyn Gijsreyn force-pushed the add-lastindexof-function branch from 7d51512 to ea85b32 Compare August 30, 2025 04:49
@Gijsreyn Gijsreyn requested a review from SteveL-MSFT August 30, 2025 04:51
@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Aug 31, 2025
Merged via the queue into PowerShell:main with commit a339349 Aug 31, 2025
4 checks passed
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.

2 participants