Skip to content

groupBy multiple key #177

Open
Open
@sckoh

Description

@sckoh
it('should allow groupBy multiple key', function() {
  var arrays = [
    { key1: 1, key2: 1, data: {} },
    { key1: 1, key2: 1, data: {} },
    { key1: 1, key2: 2, data: {} },
    { key1: 1, key2: 2, data: {} },
    { key1: 2, key2: 3, data: {} },
    { key1: 2, key2: 3, data: {} },
    { key1: 2, key2: 4, data: {} },
    { key1: 2, key2: 4, data: {} }
  ];

  expect(filter(arrays, ['key1', 'key2'])).toEqual({
    '1,1': [arrays[0], arrays[1]],
    '1,2': [arrays[2], arrays[3]],
    '2,3': [arrays[4], arrays[5]],
    '2,4': [arrays[6], arrays[7]]
  });
});

should allow to group by multiple key instead of only 1 key

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions