Skip to content

Commit

Permalink
chore: fix inline comment style
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed May 27, 2023
1 parent 354a2a8 commit 9e04b13
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion scripts/license-checker.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function checkLicenses() {
"LGPL-3.0+",
];

// merge copyleft licenses with deprecated licenses list
// Merge copyleft licenses with deprecated licenses list
copyLeftLicenses.push(...deprecatedLicenseList);

const licenses = await init({
Expand Down
26 changes: 16 additions & 10 deletions test_resources/utils/btPowerSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,38 @@ 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.
/**
* 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.
/**
* 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.
/**
* 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. Exclude last element from the subset and try the next valid one
currentSubSet.pop();
}

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

Expand Down
6 changes: 4 additions & 2 deletions test_resources/utils/genCombos.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ const btPowerSetRecursive = require("./btPowerSet");
function generateCombos(originalSet) {
const powerSet = btPowerSetRecursive(originalSet);

// Combine resulting array of arrays of objects from `btPowerSetRecursive()`
// into a single array of combined objects
/**
* Combine resulting array of arrays of objects from `btPowerSetRecursive()`
* into a single array of combined objects
*/
const reducedPowerSet = powerSet.map((subset) =>
subset.reduce((acc, cur) => ({ ...acc, ...cur }), {})
);
Expand Down

0 comments on commit 9e04b13

Please sign in to comment.