Uploaded image for project: 'Lucee Development'
  1. LDEV-1296

Query.reduce does not allow default value on the callback's first argument

    Details

    • Type: Bug
    • Status: Backlog
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.1.4.18
    • Fix Version/s: None
    • Labels:
      None
    • Sprint:

      Description

      See http://blog.adamcameron.me/2017/04/cfml-lucee-13-v-4-14-v-6-coldfusion-we.html

      See this test case:

      describe("reduce tests", function(){
      	var numbers = duplicate(baseNumbers);
      	
      	it ("accepts a default for the first argument", function(){
      		var ids = numbers.reduce(function(sum=[], row){
      			return sum.append(row.id);
      		});
      
      		expect(ids).toBe([1,2,3,4]);
      	});
      	it ("accepts an initial value", function(){
      		var ids = numbers.reduce(function(sum, row){
      			return sum.append(row.id);
      		}, []);
      
      		expect(ids).toBe([1,2,3,4]);
      	});
      });
      

      The first test fails on Lucee because it does not respect the default value for that sum argument.

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              da_cameron Adam Cameron
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: