AngularJS: Genericised angular.copy and added JSDoc