Skip to content

Conversation

@netomi
Copy link
Contributor

@netomi netomi commented Sep 23, 2024

This PR fixes the problem where when using a HOF like map with a chain operator, the array constructor is not respected which is added to enforce that the output is always an array regardless of the input.

Take this example:

$map([1], function($v){$v*$v})[]

returns correctly [1]. However, when using a chain operator like that:

$ ~> $map(function($v){$v*$v})[]

and providing [1] as input, the singleton value is returned.
This PR fixes that and adds 2 test cases to the test suite.

Copy link
Member

@mattbaileyuk mattbaileyuk left a comment

Choose a reason for hiding this comment

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

Thanks for fix!

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