Skip to content

Object-preserving map() function #220

Closed
@ThiefMaster

Description

@ThiefMaster

Would it be possible to add a map()-like function (since changing the current one would break things) which works exactly like map() but returns an object instead of an array if an object was passed?

Example:

_.map2({abc: 123, xyz: '6', foo: '9'}, function(num, key) {
    return parseInt(num, 10);
});
=> {abc: 123, xyz: 6, foo: 9}

It might also make sense to have it return [key, value] tuples but just modifying the values might be sufficient for many cases.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions