-
Notifications
You must be signed in to change notification settings - Fork 838
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lodash no longer works as a dependency, Underscore is required. #1225
Comments
Hey, It does exist: https://lodash.com/docs#includes It's an alias, see alias section. Cheers! |
TypeError: _.contains is not a function Restangular does not work with lodash. Check the error. Lodash is loaded and accessible, Restangular can see that, however restangular is unable to find the contains function. It's only working with Underscore.js. |
In the newest release of lodash, there is no contains: |
@Routhinator The last tagged version of lodash (3.10.1) does have the "contains" alias: https://github.com/lodash/lodash/blob/3.10.1/lodash.js#L12065 master branch right now is 4.0.0-pre. The "contains" alias is still listed in the docs: https://github.com/lodash/lodash/tree/master/doc#collection but yes, the alias doesn't exist in lodash.js (or dist). It looks like they have removal of aliases on the roadmap: https://github.com/lodash/lodash/wiki/Roadmap Some discussion about alias removal: lodash/lodash#1407 (comment) I think with 4.0.0 lodash is drifting away from underscore compatibility, so it may be difficult for projects to support both, unless a compatibility library is put in-between. Possible to pin your lodash dependency to latest 3.x release? |
Literally just installed Restangular and on my very first 'get()' call I get: Lodash in my bower_components folder is listed as lodash v4.0.0 so I guess I will have to roll that back to an earlier version? However whenever I run 'bower update' now I'll have to exclude this somehow. EDIT: Actually have another things that depend on lodash so this is not a preferred option |
@Vixxd you should be able to pin your lodash version to 3.x in your bower.json file like so:
|
I switched over to underscore just for Restangular. Not what I want to do, but avoids indefinitely pinning to an old lodash version. :-/ |
as @mgonto [the creator of Restangular] said, it exists under the alias "_.includes" https://lodash.com/docs#includes. So what I did was, immediately after including the Lodash library, I set _.contains = _.includes just before I included the Restangular library. If you are using Browserify for your bundling needs, you still need to set Lodash globally on the window object for Restangular to have access, after which you can set _.contains = _.includes. Hope that helps someone save a minute or 2, |
Yes i also solved it with a one liner in my (few but useful) global functions file. _.contains = _.includes; Thanks @bourgeois247 |
Restangular hat lodash als Dependency. Durch eine neue Version funktioniert Restangular nicht mehr. Deshalb zwingen wir nun Restangular die Version 2.4 von lodash zubenutzen. (siehe mgonto/restangular#1225 )
@mgonto |
I second @zanettin's suggestion. Restangular is broken and unusable at this point. Time to fork :( |
@mgonto Just curious if you're still interested in maintaining Restangular? Sounds like you might have some volunteers on this thread if not! Awesome work man.. 😄 |
Hey @preston, unfortunately, I'm not mantaining this anymore, I'm actively looking for people that want to mantain this so whoever wants to do it, I'm 100% years :D |
I wouldn't be a good choice, but there are a ton of existing forks. @elnygren / @R-Kurbatovvakoms / @nfntynl any takers? |
you can solve this issue by adding this script after including lodash :
or you can browse the restangular.js file and change _.contains by _.includes |
Lodash does not have a .contains() function. I've searched through the code. Underscore does, however Lodash, if it had one, has removed it. As of right now, installing Restangular today will only work with Underscore.js
Docs should be updated, unless you want to go the route of adding support for the new functions in lodash.js
The text was updated successfully, but these errors were encountered: