From f8782941a8e537e1805c8f6ba3c8d5a2e90e74cd Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Thu, 9 Sep 2021 20:46:28 +0800 Subject: [PATCH] chore: adjust the function name and comment a little bit --- snapshot.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snapshot.js b/snapshot.js index 7ea2cbf8..ef7aa721 100644 --- a/snapshot.js +++ b/snapshot.js @@ -13,11 +13,10 @@ function createProjectWithFeatureFlags(flags) { const featureFlags = ['typescript', 'jsx', 'router', 'vuex', 'with-tests'] -function getCombinations(arr) { +// The following code & comments are generated by GitHub CoPilot. +function fullCombination(arr) { const combinations = [] - // The following code & comments are generated by GitHub CoPilot. - // for an array of 5 elements, there are 2^5 - 1= 31 combinations // (excluding the empty combination) // equivalent to the following: @@ -29,6 +28,7 @@ function getCombinations(arr) { // [0, 0, 0, 0, 1] = 0b0001 // [1, 1, 1, 1, 1] = 0b1111 + // Note we need to exclude the empty comination in our case for (let i = 1; i < 1 << arr.length; i++) { const combination = [] for (let j = 0; j < arr.length; j++) { @@ -42,7 +42,7 @@ function getCombinations(arr) { return combinations } -const flagCombinations = getCombinations(featureFlags) +const flagCombinations = fullCombination(featureFlags) flagCombinations.push(['default']) for (const flags of flagCombinations) { -- 2.39.5