Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@marvelapp/react-ab-test

Package Overview
Dependencies
Maintainers
13
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marvelapp/react-ab-test - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

10

lib/emitter.js

@@ -20,2 +20,3 @@ "use strict";

var playedExperiments = {};
var customDistributionAlgorithm = undefined;
var emitter = new _fbemitter.EventEmitter();

@@ -60,2 +61,3 @@

playedExperiments = {};
customDistributionAlgorithm = undefined;
};

@@ -137,2 +139,6 @@

PushtellEventEmitter.prototype.setCustomDistributionAlgorithm = function (customAlgorithm) {
customDistributionAlgorithm = customAlgorithm;
};
PushtellEventEmitter.prototype.defineVariants = function (experimentName, variantNames, variantWeights) {

@@ -196,2 +202,6 @@ var variantsNamesMap = {};

PushtellEventEmitter.prototype.calculateActiveVariant = function (experimentName, userIdentifier, defaultVariantName) {
if (customDistributionAlgorithm !== undefined) {
return customDistributionAlgorithm(experimentName, userIdentifier, defaultVariantName);
}
var variant = (0, _calculateActiveVariant["default"])(experimentName, userIdentifier, defaultVariantName);

@@ -198,0 +208,0 @@ return variant;

2

package.json

@@ -14,3 +14,3 @@ {

"main": "index.js",
"version": "3.0.1",
"version": "3.1.0",
"description": "A/B testing React components and debug tools. Isomorphic with a simple, universal interface. Well documented and lightweight. Tested in popular browsers and Node.js. Includes helpers for Mixpanel and Segment.com.",

@@ -17,0 +17,0 @@ "directories": {

@@ -63,2 +63,3 @@ # A/B Testing React Components

- [`emitter.getSortedVariants(experimentName)`](#emittergetsortedvariantsexperimentname)
- [`emitter.setCustomDistributionAlgorithm(customAlgorithm)`](#emittersetcustomdistributionalgorithmcustomalgorithm)
- [`Subscription`](#subscription)

@@ -636,2 +637,23 @@ - [`subscription.remove()`](#subscriptionremove)

#### `emitter.setCustomDistributionAlgorithm(customAlgorithm)`
Sets a custom function to use for calculating variants overriding the default. This can be usefull
in cases when variants are expected from 3rd parties or when variants need to be
in sync with other clients using ab test but different distribution algorithm.
- **Return Type:** No return value
- **Parameters:**
- `customAlgorithm` - Function for calculating variant distribution.
- **Required**
- **Type:** `function`
- **Callback Arguments:**
- `experimentName` - Name of the experiment.
- **Required**
- **Type:** `string`
- `userIdentifier` - User's value which is used to calculate the variant
- **Required**
- **Type:** `string`
- `defaultVariantName` - Default variant passed from the experiment
- **Type:** `string`
### `Subscription`

@@ -638,0 +660,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc