restangular
restangular copied to clipboard
Removing lodash dependency?
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?
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?
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...
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…
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.
if this helps any -- lodash 4 has a host of deprecations https://github.com/lodash/lodash/wiki/Deprecations
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.