From e13f4f46504551d20cd34daedf5aae7b51575f7a Mon Sep 17 00:00:00 2001 From: Marvin Frachet Date: Thu, 17 Oct 2024 17:29:29 +0200 Subject: [PATCH] fix(repartitions): for progressive percentage --- packages/core/package.json | 2 +- packages/core/src/resolveStrategyVariant.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index b910ad4..4d60aa1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,7 +1,7 @@ { "name": "@flag-engine/core", "private": false, - "version": "0.0.7", + "version": "0.0.8", "description": "Feature flags evaluation engine, runtime agnostic", "type": "module", "main": "./dist/index.cjs.js", diff --git a/packages/core/src/resolveStrategyVariant.ts b/packages/core/src/resolveStrategyVariant.ts index 8500987..c5c79f4 100644 --- a/packages/core/src/resolveStrategyVariant.ts +++ b/packages/core/src/resolveStrategyVariant.ts @@ -9,9 +9,9 @@ export const resolveStrategyVariant = (strategy: Strategy, userKey: string) => { let cumulative = 0; const murmurkey = `${strategy.name}-${userKey}`; + const hash = murmur3(murmurkey); const variant = strategy.variants.find((variant) => { - const hash = murmur3(murmurkey); const userFlagPercentage = (hash / MAX_INT_32) * 100; cumulative += variant.percent;