Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/index.browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type NarouNovel from "./narou.js";
import type { ExecuteOptions } from "./narou.js";
import NarouNovelJsonp from "./narou-jsonp.js";
import SearchBuilder from "./search-builder.js";
import SearchBuilderR18 from "./search-builder-r18.js";
Expand Down Expand Up @@ -67,13 +68,16 @@ export function ranking(api: NarouNovel = narouNovelJsonp): RankingBuilder {
/**
* なろう殿堂入り API でランキング履歴を取得する
* @param {string} ncode 小説のNコード
* @param {ExecuteOptions} [options] 実行オプション
* @param {NarouNovel} [api] API実行クラスのインスタンス

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

JSDocの api パラメータにデフォルト値を記載すると、より分かりやすくなります。JSDocの標準的な記法に従い [api=narouNovelJsonp] のように記述することで、この関数を利用する開発者がIDEのヒントなどでデフォルトの挙動を把握しやすくなります。

Suggested change
* @param {NarouNovel} [api] API実行クラスのインスタンス
* @param {NarouNovel} [api=narouNovelJsonp] API実行クラスのインスタンス

* @see https://dev.syosetu.com/man/rankinapi/
*/
export async function rankingHistory(
ncode: string,
options?: ExecuteOptions,
api: NarouNovel = narouNovelJsonp
): Promise<RankingHistoryResult[]> {
const result = await api.executeRankingHistory({ ncode });
const result = await api.executeRankingHistory({ ncode }, options);
if (Array.isArray(result)) {
return result.map(formatRankingHistory);
} else {
Expand Down
Loading