style($route): make some jshint recommended changes

Syntax changes:
- ternary indentation
- remove unused variable, N
- use triple equals instead of double

Closes #3559
This commit is contained in:
Josh Taylor 2013-08-13 09:49:29 -07:00 committed by Igor Minar
parent dba5e16269
commit 8a000a586d

View file

@ -16,7 +16,7 @@
* <pre> * <pre>
* angular.module('App', ['ngRoute']); * angular.module('App', ['ngRoute']);
* </pre> * </pre>
* *
*/ */
var ngRouteModule = angular.module('ngRoute', ['ng']). var ngRouteModule = angular.module('ngRoute', ['ng']).
@ -47,8 +47,8 @@ function $RouteProvider(){
* * `path` can contain named groups starting with a colon (`:name`). All characters up * * `path` can contain named groups starting with a colon (`:name`). All characters up
* to the next slash are matched and stored in `$routeParams` under the given `name` * to the next slash are matched and stored in `$routeParams` under the given `name`
* when the route matches. * when the route matches.
* * `path` can contain named groups starting with a colon and ending with a star (`:name*`). * * `path` can contain named groups starting with a colon and ending with a star (`:name*`).
* All characters are eagerly stored in `$routeParams` under the given `name` * All characters are eagerly stored in `$routeParams` under the given `name`
* when the route matches. * when the route matches.
* * `path` can contain optional named groups with a question mark (`:name?`). * * `path` can contain optional named groups with a question mark (`:name?`).
* *
@ -139,8 +139,8 @@ function $RouteProvider(){
// create redirection for trailing slashes // create redirection for trailing slashes
if (path) { if (path) {
var redirectPath = (path[path.length-1] == '/') var redirectPath = (path[path.length-1] == '/')
? path.substr(0, path.length-1) ? path.substr(0, path.length-1)
: path +'/'; : path +'/';
routes[redirectPath] = extend( routes[redirectPath] = extend(
{redirectTo: path}, {redirectTo: path},
@ -439,13 +439,12 @@ function $RouteProvider(){
var m = route.regexp.exec(on); var m = route.regexp.exec(on);
if (!m) return null; if (!m) return null;
var N = 0;
for (var i = 1, len = m.length; i < len; ++i) { for (var i = 1, len = m.length; i < len; ++i) {
var key = keys[i - 1]; var key = keys[i - 1];
var val = 'string' == typeof m[i] var val = 'string' == typeof m[i]
? decodeURIComponent(m[i]) ? decodeURIComponent(m[i])
: m[i]; : m[i];
if (key && val) { if (key && val) {
params[key.name] = val; params[key.name] = val;
@ -552,7 +551,7 @@ function $RouteProvider(){
function interpolate(string, params) { function interpolate(string, params) {
var result = []; var result = [];
forEach((string||'').split(':'), function(segment, i) { forEach((string||'').split(':'), function(segment, i) {
if (i == 0) { if (i === 0) {
result.push(segment); result.push(segment);
} else { } else {
var segmentMatch = segment.match(/(\w+)(.*)/); var segmentMatch = segment.match(/(\w+)(.*)/);