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) {
}