restangular icon indicating copy to clipboard operation
restangular copied to clipboard

Removing lodash dependency?

Open pedromarce opened this issue 9 years ago • 6 comments

I have taken a quick look at how much effort it would be to remove lodash dependency, there are 139 uses of a lodash function in restangular, from those, all but 20 are easily converted to use an angular version of same function (pending of testing that it has no side effects). From those 20, there are occurrences of isBoolean, isEmpty, defaults, union, values, pick, omit and every. I think it is probably too much of a problem to use lodash only for these functions, should we just try to remove them? What do you think?

pedromarce avatar Feb 16 '16 10:02 pedromarce

I also thought about opening up a ticket for that and searched how many calls of _. functions are there. Most of them (isBoolean, isEmpty, isUndefined) could be rewritten in vanilla js without a hassle. Maybe we should try to rewrite this in a separate branch. I don't see any good point apart of those mentioned here in the README.

What do the others (maybe @xeor) thing about it?

ConcurrentHashMap avatar Feb 16 '16 10:02 ConcurrentHashMap

Personally, I really enjoy what restangular have to give, but I think it's main job is done. Fixing bugs that breaks is fine, but I would not think that too much of a change is worth it. Restangular have done a fantastic and needed job for angular 1, but I don't think it is needed that much in angular 2.

Stripping away lodash just to trim down on the deps just doesn't feel right at the moment. There are so many other issues open, and I think the community would rather want a restangular-ish lib for angular 2 instead as well?

Just a couple of thoughts...

xeor avatar Feb 16 '16 19:02 xeor

From what I've read of Restangular 2.0, it was/is supposed to an Angular de-coupled version. I don't think coupling Restangular to Angular is the best thing (replacing Lodash with Angular functions), so I'd throw my vote against that. However, rewriting in vanilla JS would work well, but comes with the downside of not having all the extra stuff that Lodash offers. Just my two cents though…

daviesgeek avatar Feb 16 '16 22:02 daviesgeek

I wouldn't mind seeing a PR with these changes at some point. Let me know if you need any help; I'd be glad to help out.

daviesgeek avatar Jun 17 '16 05:06 daviesgeek

if this helps any -- lodash 4 has a host of deprecations https://github.com/lodash/lodash/wiki/Deprecations

bingomanatee avatar Oct 05 '16 22:10 bingomanatee

I am using ramdaJs with my code but I had to load lodash just so that restangular can use it. Decoupling it from any external library including lodash will be good.

Rafi993 avatar Apr 05 '17 11:04 Rafi993