code: function generateVariationsOverConditions(conditionList) {
        const curCondition = conditionList[0];
  
        if (!curCondition) {
          return [];
        }
  
        // get combinations from the n - 1th dimension
        const nextVariations = generateVariationsOverConditions(
          conditionList.slice(1)
        );
        const variations = [];
  
        if (!nextVariations.length) {
          for (const curConditionValue of conditionalEnv[curCondition]) {
            const variationConditions = {};
            variationConditions[curCondition] = curConditionValue;
            variations.push(variationConditions);
          }
        }
  
        // multiply the combinations of the n - 1 dimension by the cominations of this nth dimension
        for (const nextVariation of nextVariations) {
          for (const curConditionValue of conditionalEnv[curCondition]) {
            const variationConditions = Object.assign({}, nextVariation);
            variationConditions[curCondition] = curConditionValue;
            variations.push(variationConditions);
          }
        }
  
        return variations;
      }
docs: generate conditional combinations recursively (for general case of arbitrarily many conditional combinations)