Skip to content

Commit

Permalink
Move extractArguments helper out of the object
Browse files Browse the repository at this point in the history
  • Loading branch information
locks committed Sep 19, 2017
1 parent 1d3d8d4 commit b2dab50
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions packages/ember-routing/lib/services/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ const RouterService = Service.extend({
@public
*/
isActive(/* routeName, ...models, options */) {
let { routeName, models, queryParams } = this._extractArguments(...arguments);
let { routeName, models, queryParams } = extractArguments(...arguments);
let routerMicrolib = this._router._routerMicrolib;
let state = routerMicrolib.state;

Expand All @@ -225,20 +225,20 @@ const RouterService = Service.extend({
}

return true;
},
}
});

_extractArguments(routeName, ...models) {
let possibleQueryParams = models[models.length - 1];
let queryParams = {};
function extractArguments(routeName, ...models) {
let possibleQueryParams = models[models.length - 1];
let queryParams = {};

if (possibleQueryParams && possibleQueryParams.hasOwnProperty('queryParams')) {
let options = models.pop();
queryParams = options.queryParams;
}

return { routeName, models, queryParams };
if (possibleQueryParams && possibleQueryParams.hasOwnProperty('queryParams')) {
let options = models.pop();
queryParams = options.queryParams;
}
});

return { routeName, models, queryParams };
}

function resemblesURL(str) {
return typeof str === 'string' && (str === '' || str[0] === '/');
Expand Down

0 comments on commit b2dab50

Please sign in to comment.