unleash-client
Advanced tools
Comparing version 4.2.1 to 5.0.0
@@ -56,3 +56,4 @@ "use strict"; | ||
if ((_b = parent.variants) === null || _b === void 0 ? void 0 : _b.length) { | ||
return parent.variants.includes(this.getVariant(parent.feature, context).name); | ||
const { name, featureEnabled } = this.getVariant(parent.feature, context); | ||
return featureEnabled && parent.variants.includes(name); | ||
} | ||
@@ -59,0 +60,0 @@ return this.isEnabled(parent.feature, context, () => false); |
@@ -1,1 +0,1 @@ | ||
{ "name": "unleash-client-node", "version": "4.2.1", "sdkVersion": "unleash-client-node:4.2.1" } | ||
{ "name": "unleash-client-node", "version": "5.0.0", "sdkVersion": "unleash-client-node:5.0.0" } |
@@ -36,3 +36,3 @@ "use strict"; | ||
} | ||
const normalizedUserId = (0, util_1.default)(stickinessId, groupId); | ||
const normalizedUserId = (0, util_1.normalizedStrategyValue)(stickinessId, groupId); | ||
return percentage > 0 && normalizedUserId <= percentage; | ||
@@ -39,0 +39,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
const groupId = parameters.groupId || ''; | ||
const normalizedId = (0, util_1.default)(sessionId, groupId); | ||
const normalizedId = (0, util_1.normalizedStrategyValue)(sessionId, groupId); | ||
return percentage > 0 && normalizedId <= percentage; | ||
@@ -19,0 +19,0 @@ } |
@@ -16,3 +16,3 @@ "use strict"; | ||
const groupId = parameters.groupId || ''; | ||
const normalizedUserId = (0, util_1.default)(userId, groupId); | ||
const normalizedUserId = (0, util_1.normalizedStrategyValue)(userId, groupId); | ||
return percentage > 0 && normalizedUserId <= percentage; | ||
@@ -19,0 +19,0 @@ } |
@@ -1,2 +0,3 @@ | ||
export default function normalizedValue(id: string, groupId: string, normalizer?: number): number; | ||
export declare function normalizedStrategyValue(id: string, groupId: string): number; | ||
export declare function normalizedVariantValue(id: string, groupId: string, normalizer: number): number; | ||
//# sourceMappingURL=util.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.normalizedVariantValue = exports.normalizedStrategyValue = void 0; | ||
const murmurHash3 = require("murmurhash3js"); | ||
function normalizedValue(id, groupId, normalizer = 100) { | ||
return (murmurHash3.x86.hash32(`${groupId}:${id}`) % normalizer) + 1; | ||
function normalizedValue(id, groupId, normalizer, seed = 0) { | ||
const hash = murmurHash3.x86.hash32(`${groupId}:${id}`, seed); | ||
return (hash % normalizer) + 1; | ||
} | ||
exports.default = normalizedValue; | ||
const STRATEGY_SEED = 0; | ||
function normalizedStrategyValue(id, groupId) { | ||
return normalizedValue(id, groupId, 100, STRATEGY_SEED); | ||
} | ||
exports.normalizedStrategyValue = normalizedStrategyValue; | ||
const VARIANT_SEED = 86028157; | ||
function normalizedVariantValue(id, groupId, normalizer) { | ||
return normalizedValue(id, groupId, normalizer, VARIANT_SEED); | ||
} | ||
exports.normalizedVariantValue = normalizedVariantValue; | ||
//# sourceMappingURL=util.js.map |
@@ -57,3 +57,3 @@ "use strict"; | ||
const { stickiness } = variants[0]; | ||
const target = (0, util_1.default)(getSeed(context, stickiness), groupId, totalWeight); | ||
const target = (0, util_1.normalizedVariantValue)(getSeed(context, stickiness), groupId, totalWeight); | ||
let counter = 0; | ||
@@ -60,0 +60,0 @@ const variant = variants.find((v) => { |
{ | ||
"name": "unleash-client", | ||
"version": "4.2.1", | ||
"version": "5.0.0", | ||
"description": "Unleash Client for Node", | ||
@@ -59,3 +59,3 @@ "license": "Apache-2.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"@unleash/client-specification": "^4.5.0", | ||
"@unleash/client-specification": "^5.0.2", | ||
"ava": "^5.3.0", | ||
@@ -62,0 +62,0 @@ "coveralls": "^3.1.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
217512
2753
4