fnakstad / angular-client-side-auth

One way to implement authentication/authorization in Angular applications
http://angular-client-side-auth.herokuapp.com/
MIT License
1.63k stars 346 forks source link

angular.extend instead of _.extend #63

Closed austinpray closed 10 years ago

austinpray commented 10 years ago

Hello! What a wonderful repo, thank you for making this available.

One thing I am curious about: is there a particular reason you are using _.extend in the Auth factory? https://github.com/fnakstad/angular-client-side-auth/blob/master/client/js/services.js#L13

My own personal preference is to use angular.extend simply to reduce external dependencies wherever I can. But I was wondering if there are any arguments for using the underscore extend instead? Am I missing out on anything by using 'angular.extend'? Looking at the source for both, they seem functionally equivalent.

All things equal, angular.extend is technically faster. http://jsperf.com/angular-extend-vs-underscore-extend/ http://jsperf.com/angular-extend-vs-underscore-extend/5

Thank you!

fnakstad commented 10 years ago

The only reason was that I was using Underscore for some old directives, and wasn't aware of the Angular API having an extend function available. I see you have submitted a pull request removing the Underscore dependency, so I've gone ahead and merged it. Really helps having a fresh set of eyes taking a look at the code ;)