Created
October 21, 2013 17:13
-
-
Save vojtajina/7087392 to your computer and use it in GitHub Desktop.
A proposal on refactoring https://github.com/angular/angular.js/blob/master/src/ngResource/resource.js#L480-L493 towards making jshint happy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (action.isArray) { | |
if (!angular.isArray(data)) { | |
throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected response to contain an array but got an object'); | |
} | |
value.length = 0; | |
forEach(data, function(item) { | |
value.push(new Resource(item)); | |
}); | |
} else { | |
if (angular.isArray(data)) { | |
throw $resourceMinErr('badcfg', 'Error in resource configuration. Expected response to contain an object but got an array'); | |
} | |
copy(data, value); | |
value.$promise = promise; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment