diff options
| author | Alon Levy <alon@pobox.com> | 2014-10-08 16:07:00 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-10-08 16:07:18 +0300 |
| commit | 3c86c9dd12ea0be0d353020db7a3d0582944a5cd (patch) | |
| tree | fd3b46e2844fc0fffc3fc974d6bd1f22dc284adb | |
| parent | 4aa9df9352080ec5f45730ccf5594395fb0a86bf (diff) | |
textanalysis: use and instead of nested ifs (refactor)
| -rw-r--r-- | scripts/textanalysis.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/textanalysis.js b/scripts/textanalysis.js index 8e2cfb96..68881fcc 100644 --- a/scripts/textanalysis.js +++ b/scripts/textanalysis.js @@ -161,7 +161,9 @@ var textAnalyser2 = function (newtext, finalize) { quoteword += subsegment[k] + " "; if(subsegment[k].charAt(subsegment[k].length-1) !== '"')k++; } while (k < subsegment.length && subsegment[k].charAt(subsegment[k].length - 1) !== '"'); - if(subsegment[k])if(subsegment[k]!==quoteword.replace(/ /g, ""))quoteword += subsegment[k]; + if (subsegment[k] && subsegment[k]!==quoteword.replace(/ /g, "")) { + quoteword += subsegment[k]; + } sentence.push(quoteword.replace(/"/g, "")); } else { sentence.push(subsegment[k]); |
