Duplicate
Details
Assignee
UnassignedUnassignedReporter
Brad WoodBrad WoodNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Priority
New
Details
Details
Assignee
Unassigned
UnassignedReporter
Brad Wood
Brad WoodNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Priority
Created 1 July 2022 at 16:10
Updated 7 July 2022 at 05:40
Resolved 5 July 2022 at 05:45
Consider the following code:
// For Adobe compat nullValue=()=>{}; arr = ['test',nullValue()] writedump(arr) writedump(arr.map((x)=>'replaced'))
https://trycf.com/gist/50a3d3c527a467e6d748702f5d66e140/lucee5?theme=monokai
On Adobe, the map calls the closure twice and replaces both item in the original array. But on Lucee, the map closure is never called for null values, causing those values to be completely omitted from the final mapped array.
A “map” operation, by definition, must return the same number of elements as the original data structure. So it is explicitly invalid for Lucee to map an array with 2 indexes and return an array with only 1 index.
The same problem exists with arrayEach() and arrayReduce().