Skip to content

Commit

Permalink
refactor($state): use map function in get()
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Jun 5, 2014
1 parent 80766cd commit 6b0ddb2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -1129,16 +1129,12 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
* @description
* Returns the state configuration object for any specific state or all states.
*
* @param {string|object=} stateOrName (absolute or relative) If provided, will only get the config for
* @param {string|Sbject=} stateOrName (absolute or relative) If provided, will only get the config for
* the requested state. If not provided, returns an array of ALL state configs.
* @returns {object|array} State configuration object or array of all objects.
* @returns {Object|Array} State configuration object or array of all objects.
*/
$state.get = function (stateOrName, context) {
if (arguments.length === 0) {
var list = [];
forEach(states, function(state) { list.push(state.self); });
return list;
}
if (arguments.length === 0) return objectKeys(states).map(function(name) { return states[name].self; });
var state = findState(stateOrName, context);
return (state && state.self) ? state.self : null;
};
Expand Down

0 comments on commit 6b0ddb2

Please sign in to comment.