Skip to content

Commit

Permalink
Lodash.contains is not valid anymore, fixes mgonto#1298
Browse files Browse the repository at this point in the history
Lodash had an alias named `contains` that pointed to `includes`. This alias is removed in the newly release of lodash.
Since this was an alias, there shoulnt be any reason to include logic to suport v3 of lodash.
  • Loading branch information
xeor committed Jan 15, 2016
1 parent aad3a84 commit 16d69af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/restangular.js
Expand Up @@ -13,7 +13,7 @@ restangular.provider('Restangular', function() {
*/
var safeMethods= ['get', 'head', 'options', 'trace', 'getlist'];
config.isSafe = function(operation) {
return _.contains(safeMethods, operation.toLowerCase());
return _.includes(safeMethods, operation.toLowerCase());
};

var absolutePattern = /^https?:\/\//i;
Expand Down Expand Up @@ -390,7 +390,7 @@ restangular.provider('Restangular', function() {
object.setParentless = function(values) {
if (_.isArray(values)) {
config.shouldSaveParent = function(route) {
return !_.contains(values, route);
return !_.includes(values, route);
};
} else if (_.isBoolean(values)) {
config.shouldSaveParent = function() {
Expand Down Expand Up @@ -1307,7 +1307,7 @@ restangular.provider('Restangular', function() {
serv.getList = _.bind(collection.getList, collection);

for (var prop in collection) {
if (collection.hasOwnProperty(prop) && _.isFunction(collection[prop]) && !_.contains(knownCollectionMethods, prop)) {
if (collection.hasOwnProperty(prop) && _.isFunction(collection[prop]) && !_.includes(knownCollectionMethods, prop)) {
serv[prop] = _.bind(collection[prop], collection);
}
}
Expand Down

3 comments on commit 16d69af

@xeor
Copy link
Owner Author

@xeor xeor commented on 16d69af Jan 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there are any reason to test this extensively. It worked for me, and the changelog for lodash is pretty clear.

@nitish24p
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@kwaw-danflo
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try running npm install && bower install

Please sign in to comment.