Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

refactor: simplify conditional assignment statements via ternary operator #5065

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/ng/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1369,11 +1369,9 @@ function $CompileProvider($provide) {
function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
var attrs, $element, i, ii, linkFn, controller, isolateScope, elementControllers = {}, transcludeFn;

if (compileNode === linkNode) {
attrs = templateAttrs;
} else {
attrs = shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
}
attrs = (compileNode === linkNode)
? templateAttrs
: shallowCopy(templateAttrs, new Attributes(jqLite(linkNode), templateAttrs.$attr));
$element = attrs.$$element;

if (newIsolateScopeDirective) {
Expand Down
6 changes: 1 addition & 5 deletions src/ng/filter/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,7 @@ function dateFilter($locale) {
format = format || 'mediumDate';
format = $locale.DATETIME_FORMATS[format] || format;
if (isString(date)) {
if (NUMBER_STRING.test(date)) {
date = int(date);
} else {
date = jsonStringToDate(date);
}
date = NUMBER_STRING.test(date) ? int(date) : jsonStringToDate(date);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one works for me.

}

if (isNumber(date)) {
Expand Down
6 changes: 1 addition & 5 deletions src/ng/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ function parseHeaders(headers) {
val = trim(line.substr(i + 1));

if (key) {
if (parsed[key]) {
parsed[key] += ', ' + val;
} else {
parsed[key] = val;
}
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too

}
});

Expand Down
6 changes: 1 addition & 5 deletions src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,7 @@ Lexer.prototype = {
string += String.fromCharCode(parseInt(hex, 16));
} else {
var rep = ESCAPE[ch];
if (rep) {
string += rep;
} else {
string += ch;
}
string = string + (rep || ch);
}
escape = false;
} else if (ch === '\\') {
Expand Down
6 changes: 1 addition & 5 deletions src/ngScenario/Scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,7 @@ _jQuery.fn.bindings = function(windowJquery, bindExp) {
}
for(var fns, j=0, jj=binding.length; j<jj; j++) {
fns = binding[j];
if (fns.parts) {
fns = fns.parts;
} else {
fns = [fns];
}
fns = fns.parts || [fns];
for (var scope, fn, i = 0, ii = fns.length; i < ii; i++) {
if(match((fn = fns[i]).exp)) {
push(fn(scope = scope || element.scope()));
Expand Down