Skip to content

uniqBy only works when iteratee returns a primitive value #4988

Closed
@steinybot

Description

@steinybot

I was expecting the following:

_.uniqBy([{ 'x': { 'y': 1 } }, { 'x': { 'y': 2 } }, { 'x': { 'y': 1 } }], 'x');

to return:

[{ 'x': { 'y': 1 } }, { 'x': { 'y': 2 } } }]

but it returns:

[{ 'x': { 'y': 1 } }, { 'x': { 'y': 2 } }, { 'x': { 'y': 1 } }]

Is this a bug or just an undocumented restriction?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions