0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

JSDocの書き方

Posted at

JSDocの書き方について簡単にメモしておく。

JSDocとは

JSDocとは、JavaScript用のAPIドキュメントジェネレータのこと。jsdocコマンドを実行することでHTML形式のドキュメントを作成することができる。

インストール方法

JSDocは、npmから以下のようにインストールできる。

// グローバルインストールの場合
npm install -g jsdoc

// ローカルインストールの場合
npm install --save-dev jsdoc

JSDocの主なタグ

JSDocで使用されるタグの一部を紹介する。

@param : 引数

/**
 * @param {<型>} <引数名> - <説明>
 *
 * @param {string} name - 名前
 */

@return : 返り値

/**
 * @return {<型>} <説明>
 *
 * @param {boolean} 真偽値を返す
 */

@throws : 例外

/**
 * @throws {<型>} <説明>
 */

@classdesc : クラスの説明

/**
 * @classdesc <クラスの説明>
 */

@constructor : コンストラクタ

/**
 * <コンストラクタの説明>
 * @constructor 
 */

ドキュメントの作成

HTML形式のドキュメントを作成するには、jsdocをグローバルインストールした場合次のコマンドを実行する。

jsdoc <ソースフォルダ・ファイル名>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?