Skip to content

Instantly share code, notes, and snippets.

@rlnorthcutt
Last active November 2, 2023 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rlnorthcutt/ef8c95a0dbd886c1b470c60650265a1b to your computer and use it in GitHub Desktop.
Save rlnorthcutt/ef8c95a0dbd886c1b470c60650265a1b to your computer and use it in GitHub Desktop.
Test file for JSDocLite
/**
* Sample JS Library for testing JSDoc parsing.
* @module SampleJSLibrary
*/
/**
* A constant value representing the library version.
* @const {string} VERSION
* @desc The version of the library.
*/
const VERSION = "1.0.0";
/**
* A constant value representing the library name.
* @constant {string} LIB_NAME
* @description The name of the library.
* this is the next line.
*/
const LIB_NAME = "SampleJSLibrary";
/**
* A utility function to add two numbers.
* @function add
* @param {number} a - The first number.
* @param {number} b - The second number.
* @returns {number} The sum of a and b.
* @example
* const result = add(1, 2); // result will be 3
*/
function add(a, b) {
return a + b;
}
/**
* A utility method to subtract two numbers.
* @method subtract
* @arg {number} a - The first number.
* @argument {number} b - The second number.
* @return {number} The result of a minus b.
* @example
* const result = subtract(3, 1); // result will be 2
*/
const subtract = (a, b) => {
return a - b;
};
/**
* A utility method to multiply two numbers.
* @func multiply
* @param {number} a - The first number.
* @param {number} b - The second number.
* @returns {number} The product of a and b.
* @link https://example.com/multiply-docs
* @async
*/
const multiply = (a, b) => {
return a * b;
};
/**
* A utility method to divide two numbers.
* @param {number} a - The dividend.
* @param {number} b - The divisor.
* @returns {number} The quotient of a divided by b.
* @async
*/
const divide = async (a, b) => {
if (b === 0) throw new Error("Cannot divide by zero");
return a / b;
};
/**
* A utility method to get the remainder of two numbers.
* @param {number} a - The dividend.
* @param {number} b - The divisor.
* @returns {number} The remainder of a divided by b.
*/
const remainder = (a, b) => {
return a % b;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment