@splitsoftware/splitio
Advanced tools
Comparing version 0.21.0 to 0.22.0
@@ -1,36 +0,3 @@ | ||
/* @flow */ 'use strict'; | ||
let coreSettings = require('./settings'); | ||
let core = require('./core'); | ||
let tracker = require('@splitsoftware/splitio-metrics').sdk.tracker(); | ||
let log = require('debug')('splitio'); | ||
function splitio(settings /*: object */) /*: Promise */ { | ||
// setup settings for all the modules | ||
coreSettings.configure(settings); | ||
return core.start().then(storage => { | ||
return { | ||
getTreatment(key /*: string */, featureName /*: string */) /*: string */ { | ||
let split = storage.splits.get(featureName); | ||
let treatment = 'control'; | ||
let stop = tracker(); | ||
if (split) { | ||
treatment = split.getTreatment(key); | ||
log(`feature ${featureName} key ${key} evaluated as ${treatment}`); | ||
} else { | ||
log(`feature ${featureName} doesn't exist`); | ||
} | ||
stop(); | ||
return treatment; | ||
} | ||
}; | ||
}); | ||
} | ||
module.exports = splitio; | ||
// browserify blacklist the file used for nodejs in the package json, so I | ||
// needed to separate the implementation in this way to prevent problems. | ||
module.exports = require('./node'); |
@@ -1,37 +0,6 @@ | ||
/* @flow */'use strict'; | ||
'use strict'; | ||
var coreSettings = require('./settings'); | ||
var core = require('./core'); | ||
var tracker = require('@splitsoftware/splitio-metrics').sdk.tracker(); | ||
var log = require('debug')('splitio'); | ||
function splitio(settings /*: object */) /*: Promise */{ | ||
// setup settings for all the modules | ||
coreSettings.configure(settings); | ||
return core.start().then(function (storage) { | ||
return { | ||
getTreatment: function getTreatment(key /*: string */, featureName /*: string */) /*: string */{ | ||
var split = storage.splits.get(featureName); | ||
var treatment = 'control'; | ||
var stop = tracker(); | ||
if (split) { | ||
treatment = split.getTreatment(key); | ||
log('feature ' + featureName + ' key ' + key + ' evaluated as ' + treatment); | ||
} else { | ||
log('feature ' + featureName + ' doesn\'t exist'); | ||
} | ||
stop(); | ||
return treatment; | ||
} | ||
}; | ||
}); | ||
} | ||
module.exports = splitio; | ||
// browserify blacklist the file used for nodejs in the package json, so I | ||
// needed to separate the implementation in this way to prevent problems. | ||
module.exports = require('./node'); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@splitsoftware/splitio", | ||
"version": "0.21.0", | ||
"version": "0.22.0", | ||
"description": "Split SDK", | ||
@@ -13,2 +13,3 @@ "author": "Facundo Cabrera <facundo@split.io>", | ||
"main": "lib/index.js", | ||
"browser": "lib/browser.js", | ||
"scripts": { | ||
@@ -21,4 +22,4 @@ "build": "./scripts/build.sh", | ||
"dependencies": { | ||
"@splitsoftware/splitio-metrics": "0.21.0", | ||
"@splitsoftware/splitio-cache": "0.21.0", | ||
"@splitsoftware/splitio-metrics": "0.22.0", | ||
"@splitsoftware/splitio-cache": "0.22.0", | ||
"debug": "^2.2.0" | ||
@@ -25,0 +26,0 @@ }, |
Sorry, the diff of this file is not supported yet
39306
28
547