@splitsoftware/splitio
Advanced tools
Comparing version 0.20.0 to 0.21.0
@@ -16,15 +16,13 @@ /* @flow */ 'use strict'; | ||
return { | ||
getTreatment(key /*: string */, featureName /*: string */, defaultTreatment /*: string */) /*: string */ { | ||
getTreatment(key /*: string */, featureName /*: string */) /*: string */ { | ||
let split = storage.splits.get(featureName); | ||
let treatment = null; | ||
let treatment = 'control'; | ||
let stop = tracker(); | ||
if (split) { | ||
treatment = split.getTreatment(key, defaultTreatment); | ||
treatment = split.getTreatment(key); | ||
log(`feature ${featureName} key ${key} evaluated as ${treatment}`); | ||
} else { | ||
treatment = defaultTreatment; | ||
log(`feature ${featureName} doesn't exist, using default ${treatment}`); | ||
log(`feature ${featureName} doesn't exist`); | ||
} | ||
@@ -34,6 +32,2 @@ stop(); | ||
return treatment; | ||
}, | ||
isTreatment(key /*: string */, featureName /*: string */, treatment /*: string */) /*: bool */ { | ||
return this.getTreatment(key, featureName) === treatment; | ||
} | ||
@@ -40,0 +34,0 @@ }; |
@@ -16,15 +16,13 @@ /* @flow */'use strict'; | ||
return { | ||
getTreatment: function getTreatment(key /*: string */, featureName /*: string */, defaultTreatment /*: string */) /*: string */{ | ||
getTreatment: function getTreatment(key /*: string */, featureName /*: string */) /*: string */{ | ||
var split = storage.splits.get(featureName); | ||
var treatment = null; | ||
var treatment = 'control'; | ||
var stop = tracker(); | ||
if (split) { | ||
treatment = split.getTreatment(key, defaultTreatment); | ||
treatment = split.getTreatment(key); | ||
log('feature ' + featureName + ' key ' + key + ' evaluated as ' + treatment); | ||
} else { | ||
treatment = defaultTreatment; | ||
log('feature ' + featureName + ' doesn\'t exist, using default ' + treatment); | ||
log('feature ' + featureName + ' doesn\'t exist'); | ||
} | ||
@@ -34,5 +32,2 @@ stop(); | ||
return treatment; | ||
}, | ||
isTreatment: function isTreatment(key /*: string */, featureName /*: string */, treatment /*: string */) /*: bool */{ | ||
return this.getTreatment(key, featureName) === treatment; | ||
} | ||
@@ -39,0 +34,0 @@ }; |
{ | ||
"name": "@splitsoftware/splitio", | ||
"version": "0.20.0", | ||
"version": "0.21.0", | ||
"description": "Split SDK", | ||
@@ -20,4 +20,4 @@ "author": "Facundo Cabrera <facundo@split.io>", | ||
"dependencies": { | ||
"@splitsoftware/splitio-metrics": "0.20.0", | ||
"@splitsoftware/splitio-cache": "0.20.0", | ||
"@splitsoftware/splitio-metrics": "0.21.0", | ||
"@splitsoftware/splitio-cache": "0.21.0", | ||
"debug": "^2.2.0" | ||
@@ -24,0 +24,0 @@ }, |
Sorry, the diff of this file is not supported yet
25455
351