From fea8db3c8c533f37dae7aa9aeae0b941cea316cc Mon Sep 17 00:00:00 2001 From: Burak Yigit Kaya <ben@byk.im> Date: Sun, 4 Oct 2015 15:26:14 +0300 Subject: [PATCH] Fix: Last tag always has \n in the description (fixes #87) --- lib/doctrine.js | 2 +- test/unwrap.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) 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 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 : */