JSDoc 中文网

语法

¥Syntax

@borrows <that namepath> as <this namepath>

概述

¥Overview

@borrows 标签允许你将另一个符号的文档添加到你的文档中。

¥The @borrows tag allows you to add documentation for another symbol to your documentation.

如果你有多种方法来引用某个函数,但又不想在两个地方重复相同的文档,则此标记会很有用。

¥This tag would be useful if you had more than one way to reference a function, but you didn't want to duplicate the same documentation in two places.

示例

¥Examples

在此示例中,存在 "trstr" 函数的文档,但 "util.trim" 只是使用不同名称对同一函数的引用。

¥In this example there exists documentation for the "trstr" function, but "util.trim" is just a reference to that same function by a different name.

将 trstr 的文档复制为 util.trim
/**

 * @namespace

 * @borrows trstr as trim
 */
var util = {
    trim: trstr
};

/**

 * Remove whitespace from around a string.

 * @param {string} str
 */
function trstr(str) {
}