MCPcopy Create free account
hub / github.com/Noumena-Network/code / updateExperimentDataForFeature

Function updateExperimentDataForFeature

src/services/analytics/growthbook.ts:350–371  ·  view source on GitHub ↗
(
  feature: string,
  evaluation: FeatureEvaluationSnapshot,
)

Source from the content-addressed store, hash-verified

348}
349
350function updateExperimentDataForFeature(
351 feature: string,
352 evaluation: FeatureEvaluationSnapshot,
353): void {
354 const canonicalFeature = toCanonicalAnalyticsName(feature)
355 if (
356 evaluation.source !== 'experiment' ||
357 !evaluation.experiment?.key ||
358 evaluation.experimentResult?.variationId === undefined
359 ) {
360 experimentDataByFeature.delete(canonicalFeature)
361 return
362 }
363
364 experimentDataByFeature.set(canonicalFeature, {
365 experimentId: evaluation.experiment.key,
366 variationId: evaluation.experimentResult.variationId,
367 inExperiment: evaluation.experimentResult.inExperiment,
368 hashAttribute: evaluation.experimentResult.hashAttribute,
369 hashValue: evaluation.experimentResult.hashValue,
370 })
371}
372
373/**
374 * Process a GrowthBook payload from the server and populate local caches.

Callers 2

processGrowthBookPayloadFunction · 0.85
createClientFunction · 0.85

Calls 3

toCanonicalAnalyticsNameFunction · 0.85
deleteMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected