Skip to content

_.permutation and _.combination support for arrays #47

Open
@bdkent

Description

@bdkent

It would be really useful to support the standard permutation/combination functions on arrays.

Something like:

_.permutations([0, 1], ['a', 'b']) => [ [0, 'a'], [0, 'b'], [1, 'a'], [1, 'b'] ];
_.combinations([1, 2, 3, 4], 2) => [ [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4] ];

These additions have already (and I think unfortunately) been rejected from lodash proper:
lodash/lodash#1191
lodash/lodash#1032

I very frequently find the need for them, so I think they belong in lodash-contrib.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions