Browse Source

Add comments to loadInput

ApisNecros 3 months ago
parent
commit
8e9ce47e9d
1 changed files with 9 additions and 0 deletions
  1. 9 0
      common.js

+ 9 - 0
common.js

@@ -1,5 +1,14 @@
 import fs from "node:fs";
 
+/**
+ * Load the input for a day's challenge
+ *
+ * @param {string|number} dayNumber The number of the day to load. A string for a file path can be provided here too.
+ * @param {Function} parsingFunction A function to parse the input to a usable format
+ * @param {boolean} literalPath If true, the {@link dayNumber} value should be used as a file path
+ *
+ * @returns {unknown}
+ */
 export function loadInput(dayNumber, parsingFunction, literalPath = false) {
     let filePath = literalPath ? dayNumber : `./inputs/day_${dayNumber}.input`;
     const data = fs.readFileSync(filePath, "utf8");