From 8ffb9b97a67a2f43d0fc478b1369bfc64a37c28b Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Sat, 14 Dec 2024 21:10:41 +0530 Subject: [PATCH] apply nitpicks 3 --- scripts/build-post-list.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/build-post-list.js b/scripts/build-post-list.js index 70ac6e72bf8a..d716a32b4542 100644 --- a/scripts/build-post-list.js +++ b/scripts/build-post-list.js @@ -25,6 +25,14 @@ const addItem = (details) => { result["about"].push(details) }; +/** + * Builds a list of posts from the specified directories and writes it to a file + * @param {Array>} postDirectories - Array of [directory, slug] tuples + * @param {string} basePath - Base path for resolving relative paths + * @param {string} writeFilePath - Path where the output JSON will be written + * @throws {Error} If required parameters are missing or if any operation fails + * @returns {Promise} + */ async function buildPostList(postDirectories, basePath, writeFilePath) { try { @@ -144,6 +152,11 @@ async function walkDirectories(directories, resultObj, basePath, sectionTitle, s } } +/** + * Extracts heading IDs from markdown headings + * @param {string} str - The heading text containing potential ID + * @returns {string} The extracted ID or empty string if no valid ID found + */ function slugifyToC(str) { if (typeof str !== 'string') return ''; let slug = '';