Repository: eslint/doctrine (js)

Issue:
Last tag always has \n in the description
Hi,

the `unwrap: true` option fails to strip the last new line before `*/`, so an empty description on the last tag in the comment always becomes '/' (not sure why) and a non-empty description always has a newline at the end.

In my code, I have to do this to remove spaces/newlines from before the end of the comment, before passing the comment to doctrine.
     
     comment = comment.replace(/[\s\n]*\*\/[\s\n]*$/, '*/');


Thanks

Pull request:
Fix: Last tag always has \n in the description
Fixes #87.

Not sure if this is the best fix so open to suggestions.

Patch:
diff --git a/lib/doctrine.js b/lib/doctrine.js
index 01187c2..78f3ff0 100644
--- a/lib/doctrine.js
+++ b/lib/doctrine.js
@@ -159,7 +159,7 @@
             index += 1;
         }
 
-        return result;
+        return result.replace(/\s+$/, '');
     }
 
     // JSDoc Tag Parser


Test patch:
diff --git a/test/unwrap.js b/test/unwrap.js
index 03d6f6d..82f9396 100644
--- a/test/unwrap.js
+++ b/test/unwrap.js
@@ -33,7 +33,7 @@ require('should');
 
 describe('unwrapComment', function () {
   it('normal', function () {
-    doctrine.unwrapComment('/**\n * @const\n * @const\n */').should.equal('\n@const\n@const\n');
+    doctrine.unwrapComment('/**\n * @const\n * @const\n */').should.equal('\n@const\n@const');
   });
 
   it('single', function () {
@@ -46,15 +46,15 @@ describe('unwrapComment', function () {
   });
 
   it('2 lines', function () {
-    doctrine.unwrapComment('/**x\n * y\n*/').should.equal('x\ny\n');
+    doctrine.unwrapComment('/**x\n * y\n*/').should.equal('x\ny');
   });
 
   it('2 lines with space', function () {
-    doctrine.unwrapComment('/**x\n *    y\n*/').should.equal('x\n   y\n');
+    doctrine.unwrapComment('/**x\n *    y\n*/').should.equal('x\n   y');
   });
 
   it('3 lines with blank line', function () {
-    doctrine.unwrapComment('/**x\n *\n \* y\n*/').should.equal('x\n\ny\n');
+    doctrine.unwrapComment('/**x\n *\n \* y\n*/').should.equal('x\n\ny');
   });
 });
 /* vim: set sw=4 ts=4 et tw=80 : */