Skip to content

Commit b881c72

Browse files
committed
chore(common): unique name for internal function
1 parent 91f75ae commit b881c72

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

src/common.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function ancestors(first, second) {
4949
* @param {Object} object A JavaScript object.
5050
* @return {Array} Returns the keys of the object as an array.
5151
*/
52-
function keys(object) {
52+
function objectKeys(object) {
5353
if (Object.keys) {
5454
return Object.keys(object);
5555
}
@@ -97,7 +97,7 @@ function inheritParams(currentParams, newParams, $current, $to) {
9797

9898
for (var i in parents) {
9999
if (!parents[i].params) continue;
100-
parentParams = keys(parents[i].params);
100+
parentParams = objectKeys(parents[i].params);
101101
if (!parentParams.length) continue;
102102

103103
for (var j in parentParams) {

src/state.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
9191
state.params = state.params || {};
9292

9393
if (!state.parent) {
94-
return keys(state.params);
94+
return objectKeys(state.params);
9595
}
9696
var paramNames = {}; forEach(state.params, function (v, k) { paramNames[k] = true; });
9797

@@ -811,7 +811,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
811811
}
812812

813813
// Filter parameters before we pass them to event handlers etc.
814-
toParams = filterByKeys(keys(to.params), toParams || {});
814+
toParams = filterByKeys(objectKeys(to.params), toParams || {});
815815

816816
// Broadcast start event and cancel the transition if requested
817817
if (options.notify) {
@@ -1086,7 +1086,12 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
10861086
* @returns {string} compiled state url
10871087
*/
10881088
$state.href = function href(stateOrName, params, options) {
1089-
options = extend({ lossy: true, inherit: false, absolute: false, relative: $state.$current }, options || {});
1089+
options = extend({
1090+
lossy: true,
1091+
inherit: false,
1092+
absolute: false,
1093+
relative: $state.$current
1094+
}, options || {});
10901095

10911096
var state = findState(stateOrName, options.relative);
10921097

@@ -1098,7 +1103,9 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
10981103
if (!nav || !nav.url) {
10991104
return null;
11001105
}
1101-
return $urlRouter.href(nav.url, filterByKeys(keys(state.params), params || {}), { absolute: options.absolute });
1106+
return $urlRouter.href(nav.url, filterByKeys(objectKeys(state.params), params || {}), {
1107+
absolute: options.absolute
1108+
});
11021109
};
11031110

11041111
/**
@@ -1128,7 +1135,7 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
11281135
// necessary. In addition to being available to the controller and onEnter/onExit callbacks,
11291136
// we also need $stateParams to be available for any $injector calls we make during the
11301137
// dependency resolution process.
1131-
var $stateParams = (paramsAreFiltered) ? params : filterByKeys(keys(state.params), params);
1138+
var $stateParams = (paramsAreFiltered) ? params : filterByKeys(objectKeys(state.params), params);
11321139
var locals = { $stateParams: $stateParams };
11331140

11341141
// Resolve 'global' dependencies for the state, i.e. those not specific to a view.

src/urlMatcherFactory.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ UrlMatcher.prototype.exec = function (path, searchParams) {
239239
* pattern has no parameters, an empty array is returned.
240240
*/
241241
UrlMatcher.prototype.parameters = function (param) {
242-
if (!isDefined(param)) return keys(this.params);
242+
if (!isDefined(param)) return objectKeys(this.params);
243243
return this.params[param] || null;
244244
};
245245

0 commit comments

Comments
 (0)