add jsdocs for random number

This commit is contained in:
madrilene 2024-02-20 08:45:42 +01:00
parent 18fc398465
commit c126a926c6

View file

@ -1,14 +1,13 @@
/** © Andy Bell - https://buildexcellentwebsit.es/ */
module.exports = {
/**
* Returns back some attributes based on wether the
* link is active or a parent of an active item
* Returns back some attributes based on whether the
* link is active or a parent of an active item.
*
* @param {String} itemUrl The link in question
* @param {String} pageUrl The page context
* @returns {String} The attributes or empty
* @param {String} itemUrl - The link in question.
* @param {String} pageUrl - The page context.
* @returns {String} - The attributes or empty.
*/
getLinkActiveState(itemUrl, pageUrl) {
let response = '';
@ -22,19 +21,26 @@ module.exports = {
return response;
},
/**
* Take an array of keys and return back items that match.
* Note: items in the collection must have a key attribute in
* Front Matter
* Front Matter.
*
* @param {Array} collection 11ty collection
* @param {Array} keys collection of keys
* @returns {Array} result collection or empty
* @param {Array} collection - 11ty collection.
* @param {Array} keys - Collection of keys.
* @returns {Array} - Result collection or empty.
*/
filterCollectionByKeys(collection, keys) {
return collection.filter(x => keys.includes(x.data.key));
},
/**
* Generates a random UUID (Universally Unique Identifier).
*
* @returns {string} A random UUID.
*/
random() {
const segment = () => {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);