Remove some Model and Collection lodash based methods #2005
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduction
This removes some Model and Collection methods that are just a pass-through to the same named lodash methods.
Motivation
These methods are not very useful or they duplicate functionality, so they should be removed. Some of them are so strange that no one is really sure why they're still around or if they even make sense, like
Model#invert.In the case of
Collection#firstandCollection#last, they are useful as shortcuts for some often needed model, but there is no need to use lodash for that functionality.Closes #2004.
Proposed solution
A lot of these methods are simply removed. See the linked issue for the complete list. A migration guide is provided to help people that might be using these methods.
There are also two methods that are re-implemented using functionality that is already available in Bookshelf, without the need to involve lodash:
Collection#firstandCollection#last. There is no difference in terms of functionality in this case.Current PR Issues
Breaks backwards-compatibility.