2011-10-10 3 views
2

나는이 방법JSDoc에서 내 _methods를 문서화하는 방법은 무엇입니까?

/** 
* Uses the native RegExp object and the native string.replace to replace text 
* @name _replace 
* @param {String} find Text string or regex to search for 
* @param {String} replace Text string or regex for replacing 
* @param {String} string String to perfom the replace on 
* @returns {String} Returns the string with the text replaced 
*/ 
this._replace = function(find, replace, str) { 
    var regex; 

    if(typeof find !== undefined && replace !== undefined && typeof str === 'string') { 
     regex = new RegExp(find, this._getFlags()); 
     return str.replace(regex, replace, str);    
    } else { 
     return false; 
    } 

}; 

대중 인터페이스 인 replace 방법 구별하기 위해 _ 접두어를 포함하는 클래스가 있습니다. _이있을 때 JSDoc이이 메서드를 문서화하지 않는 이유는 무엇입니까? 제거하면 완벽하게 문서화됩니다. JSDoc을이 방법으로 문서화 할 수있는 방법이 있습니까?

답변

4

jsdoc-toolkit은 _으로 시작하는 메소드가 private이라고 가정합니다. 이것은 실제로 공통된 규칙입니다. 방법은 --private 옵션으로 실행하여 포함되어 있음을 알 수 있습니다.

공개적으로 문서화하려면, @public 태그를 포함하십시오.

그런데 @name을 사용할 필요가없는 경우 대부분의 경우 함수 이름이 자동으로 검색됩니다.

+0

우수합니다. 감사합니다. 나는이 질문에 대한 답변을 포기했다. Stackoverflow에 대한 특이한. – MrMisterMan

관련 문제