Skip to content

Feature request: _.deleteWhere #1856

@morgoth

Description

@morgoth

Currently having array of objects, to delete one of them I need to write:

var collection = [{id: 1}, {id: 3}];
var objectToRemove = _.findWhere(collection, function (obj) { return obj.id === 3 });
var objectIndex = collection.indexOf(objectToRemove);
collection.splice(objectIndex, 1);

It would be nice to have in underscore something like:

_.deleteWhere(collection, {id: 2})

If you find this useful I can try to implement it and send a PR.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions