@@ -22,7 +22,7 @@ import { DecisionObj } from '../decision_service';
22
22
* @returns {string } Experiment key or empty string if experiment is null
23
23
*/
24
24
export function getExperimentKey ( decisionObj : DecisionObj ) : string {
25
- return decisionObj . experiment ?. key ?? '' ;
25
+ return decisionObj . experiment ?. key ?? '' ;
26
26
}
27
27
28
28
/**
@@ -31,7 +31,7 @@ export function getExperimentKey(decisionObj: DecisionObj): string {
31
31
* @returns {string } Variation key or empty string if variation is null
32
32
*/
33
33
export function getVariationKey ( decisionObj : DecisionObj ) : string {
34
- return decisionObj . variation ?. key ?? '' ;
34
+ return decisionObj . variation ?. key ?? '' ;
35
35
}
36
36
37
37
/**
@@ -40,7 +40,7 @@ export function getVariationKey(decisionObj: DecisionObj): string {
40
40
* @returns {boolean } featureEnabled boolean or false if variation is null
41
41
*/
42
42
export function getFeatureEnabledFromVariation ( decisionObj : DecisionObj ) : boolean {
43
- return decisionObj . variation ?. featureEnabled ?? false ;
43
+ return decisionObj . variation ?. featureEnabled ?? false ;
44
44
}
45
45
46
46
/**
@@ -49,5 +49,14 @@ export function getFeatureEnabledFromVariation(decisionObj: DecisionObj): boolea
49
49
* @returns {string } Experiment id or null if experiment is null
50
50
*/
51
51
export function getExperimentId ( decisionObj : DecisionObj ) : string | null {
52
- return decisionObj . experiment ?. id ?? null ;
52
+ return decisionObj . experiment ?. id ?? null ;
53
+ }
54
+
55
+ /**
56
+ * Get variation id from the provided decision object
57
+ * @param {DecisionObj } decisionObj Object representing decision
58
+ * @returns {string } Variation id or null if variation is null
59
+ */
60
+ export function getVariationId ( decisionObj : DecisionObj ) : string | null {
61
+ return decisionObj . variation ?. id ?? null ;
53
62
}
0 commit comments