Option name | Type | Description |
---|---|---|
symbol | Object | symbol to check against |
Test if a symbol should be ignored or not
function shouldPass(symbol){
if(symbol.isPrivate){return false;}
if(symbol.ignore){return false;}
// Only for coffeescript
return symbol.tags.filter(function(tag){
return tag.type === "private" || tag.type === "ignore";
}).length === 0;
}
Option name | Type | Description |
---|---|---|
val | String | value to check against |
has Helper return a closure that check if a tag has a specific type
function has(val){
return function(tag){
return tag.type === val;
};
}
var hasParams = has('param');
var isReturn = has('return');
var hasDescription = has('description');
var hasType = has('type');
var hasJSFiddle = has('jsFiddle');
Compact multi-line expression
function _compact(tags){
// [{"type":"description","string":"Note: if `addClass` is defined at the step level."},
// {"type":"","string":"The two defined `addClass` will be taken into account in the popover"},
// {"type":"type","types":["String"]}]
var compacted = [];
tags.forEach(function(tag, i){
if(!tag.type){
if(i === 0){return;}
// append to previous
var prevTag = compacted[compacted.length-1];
if (prevTag.description) {
prevTag.description += " " + tag.string;
} else {
prevTag.string += " " + tag.string;
}
return;
}
compacted.push(tag);
});
return compacted;
}
Option name | Type | Description |
---|---|---|
filepath | String | file path of the file to parse |
Parse a file and returns a generic format
function parse(filepath){
var json = null;
try{
json = dox.parseComments(fs.readFileSync(filepath).toString(), {raw: false});
} catch(e) {
console.error("doxx:", e);
return [];
}
// json now contains an array of tags
// {
// tags:[]
// description:{
// full:""
// summary:""
// body:""
// }
// ignore:false
// isPrivate:false
// ctx:{
// type:"declaration"
// name:""
// value:[]
// string:""
// }
// }
return json.filter(shouldPass).map(_mapSymbol);
}