[Docs] Don't show copyright/flow on APIs without docblock

This commit is contained in:
Brent Vatne 2015-05-10 10:17:21 -07:00
parent 0206ab2bac
commit 120c32c52c
1 changed files with 12 additions and 2 deletions

View File

@ -105,10 +105,20 @@ function getFileDocBlock(commentsForFile) {
commentsForFile.some(function(comment, i) {
if (comment.loc.start.line === 1) {
var lines = comment.value.split('\n');
var inCopyrightBlock = false;
var filteredLines = lines.filter(function(line) {
var hasCopyright = !!line.match(/^\s*\*\s+Copyright/);
if (!!line.match(/^\s*\*\s+Copyright \(c\)/)) {
inCopyrightBlock = true;
}
var hasProvides = !!line.match(/^\s*\*\s+@provides/);
return !hasCopyright && !hasProvides;
var hasFlow = !!line.match(/^\s*\*\s+@flow/);
if (hasFlow || hasProvides) {
inCopyrightBlock = false;
}
return !inCopyrightBlock && !hasFlow && !hasProvides;
});
docblock = filteredLines.join('\n');
return true;