Skip to content

Replace Array.flat() with custom flattenArray() function for Node.js compatibility #1105

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

Merged
merged 1 commit into from
May 30, 2025

Conversation

rishabhmalikMS
Copy link
Contributor

@rishabhmalikMS rishabhmalikMS commented May 28, 2025

Problem
The current code uses Array.flat() which is only available in Node.js versions >= 12. This causes compatibility issues when running on older Node.js versions that are still supported by Azure Pipelines agents.

Changes

  • Added new flattenArray() helper function to recursively flatten nested arrays
  • Removed usage of Array.flat() method

Github Issue Link: microsoft/azure-pipelines-tasks#21048

Testing
Tested with already existing unit tests having multiple paths as input to LS function in an array.

@rishabhmalikMS rishabhmalikMS requested review from a team as code owners May 28, 2025 04:11
@rishabhmalikMS
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@rishabhmalikMS rishabhmalikMS changed the title removing flat function to get rid of its dependency Replace Array.flat() with custom flattenArray() function for Node.js compatibility May 28, 2025
@sanjuyadav24
Copy link

changes looks good, can we please update canary test pipeline to have this test case

@rishabhmalikMS rishabhmalikMS merged commit badfe9f into master May 30, 2025
6 checks passed
@rishabhmalikMS rishabhmalikMS deleted the users/rishabhmalikMS/removeFlatFunction branch May 30, 2025 07:39
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