Skip to content

Commit

Permalink
chore: tidy jsdoc description suffixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed May 16, 2024
1 parent e3f7249 commit 9ec245d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/routes/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<body>
<script>
/**
* @description Detect IE and display message if detected.
* @description Detects IE and display message if detected.
* @see {@link https://github.com/Redocly/redoc/issues/1936 | Redoc Issue #1936}
*/
if (window.document.documentMode) {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/docs/route.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`Docs route GET requests Returns HTML 1`] = `
<body>
<script>
/**
* @description Detect IE and display message if detected.
* @description Detects IE and display message if detected.
* @see {@link https://github.com/Redocly/redoc/issues/1936 | Redoc Issue #1936}
*/
if (window.document.documentMode) {
Expand Down
2 changes: 1 addition & 1 deletion src/server.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ exports[`Server deployment API documentation Content /docs route Returns HTML 1`
<body>
<script>
/**
* @description Detect IE and display message if detected.
* @description Detects IE and display message if detected.
* @see {@link https://github.com/Redocly/redoc/issues/1936 | Redoc Issue #1936}
*/
if (window.document.documentMode) {
Expand Down
5 changes: 3 additions & 2 deletions src/utils/core-count/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ const config = { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] };

/**
* @author Frazer Smith
* @description Count number of physical CPU cores a system has,
* taking into account Intel Hyper-Threading.
* @description Counts the number of physical CPU cores
* a system has, taking into account Intel Hyper-Threading.
*
* Physical core count is useful for determining the number of
* workers to spawn for CPU-bound tasks such as image processing.
* @see {@link https://github.com/nodejs/node/issues/7730 | Node.js Issue #7730}
Expand Down
28 changes: 5 additions & 23 deletions test_resources/utils/bt-power-set.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"use strict";

/**
* @description Bitwise power-set function, adapted from algorithm at
* https://github.com/trekhleb/javascript-algorithms/blob/master/src/algorithms/sets/power-set/btPowerSet.js.
* @description Generates the power set of a given set using a recursive backtracking approach.
* @param {*[]} originalSet - Original set of elements we are forming power-set of.
* @param {*[][]} allSubsets - All subsets that have been formed so far.
* @param {*[]} currentSubSet - Current subset that we are forming at the moment.
* @param {number} startAt - The position in original set we are starting to form current subset.
* @param {*[][]} [allSubsets] - All subsets that have been formed so far. Used internally for recursion.
* @param {*[]} [currentSubSet] - The current subset being formed. Used internally for recursion.
* @param {number} [startAt] - The position in the original set from which to start forming the current subset.
* @returns {*[][]} All subsets of original set.
*/
function btPowerSetRecursive(
Expand All @@ -15,38 +14,21 @@ function btPowerSetRecursive(
currentSubSet = [],
startAt = 0
) {
/**
* Let's iterate over originalSet elements that may be added to the subset
* without having duplicates. The value of startAt prevents adding the duplicates.
*/
for (let position = startAt; position < originalSet.length; position += 1) {
// Let's push current element to the subset
currentSubSet.push(originalSet[position]);

/**
* Current subset is already valid so let's memorize it.
* We do array destruction here to save the clone of the currentSubSet.
* We need to save a clone since the original currentSubSet is going to be
* mutated in further recursive calls.
*/
allSubsets.push([...currentSubSet]);

/**
* Let's try to generate all other subsets for the current subset.
* We're increasing the position by one to avoid duplicates in subset.
*/
btPowerSetRecursive(
originalSet,
allSubsets,
currentSubSet,
position + 1
);

// BACKTRACK. Exclude last element from the subset and try the next valid one
// Backtrack the current subset
currentSubSet.pop();
}

// Return all subsets of a set
return allSubsets;
}

Expand Down

0 comments on commit 9ec245d

Please sign in to comment.