adding support for @param.optional

This commit is contained in:
Igor Minar 2010-11-17 13:07:59 -08:00
parent 9d36368ff9
commit ee0e9a4452
2 changed files with 6 additions and 3 deletions

View file

@ -252,6 +252,7 @@ var TAG = {
var param = {
type: match[2],
name: match[6] || match[5],
optional: !!match[3],
'default':match[7],
description:markdownNoP(value.replace(match[0], match[8]))
};

View file

@ -83,16 +83,18 @@ describe('collect', function(){
'{(number|string)} number Number \n to format.');
expect(doc.param).toEqual([{
type : '(number|string)',
name : 'number',
name : 'number',
optional: false,
'default' : undefined,
description : 'Number \n to format.' }]);
});
it('should parse with default', function(){
it('should parse with default and optional', function(){
TAG.param(doc, 'param',
'{(number|string)=} [fractionSize=2] desc');
expect(doc.param).toEqual([{
type : '(number|string)',
name : 'fractionSize',
name : 'fractionSize',
optional: true,
'default' : '2',
description : 'desc' }]);
});