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