From 9d808239b3120b0120f164834ce3012f779c8939 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Sun, 14 Aug 2011 01:26:56 -0700 Subject: style(*): wrap all assignments in if statements we commonly assign stuff in if statments like this: if (variable = someFn()) { //do something with variable } This results in lint and IDE warnings (did you mean ==?). It is better to be explicit about our intention and wrap the assignement into parens: if ((variable = someFn())) { //do something with variable } Doing so suppresses warnings + is easier to understand the intention. I verified that the closure compiler strips the extra parens, so there is no byte overhead for this safety practice. We should use this style going forward... --- src/filters.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/filters.js') diff --git a/src/filters.js b/src/filters.js index f636b242..67e30046 100644 --- a/src/filters.js +++ b/src/filters.js @@ -610,7 +610,7 @@ angularFilter.linky = function(text) { var writer = htmlSanitizeWriter(html); var url; var i; - while (match = raw.match(LINKY_URL_REGEXP)) { + while ((match = raw.match(LINKY_URL_REGEXP))) { // We can not end in these as they are sometimes found at the end of the sentence url = match[0]; // if we did not match ftp/http/mailto then assume mailto -- cgit v1.2.3