Socket
Socket
Sign inDemoInstall

abtest

Package Overview
Dependencies
3
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abtest

an A/B test client for node web


Version published
Weekly downloads
12
increased by500%
Maintainers
1
Install size
70.8 kB
Created
Weekly downloads
 

Readme

Source

abtest

NPM version build status Test coverage David deps node version Gittip

an A/B test client for node web

Installation

$ npm install abtest

Feature

  • Random split user into different buckets.
  • Record user's bucket in cookie.
  • Force choose bucket by query.
  • Expire cookie when buckets changed.

Usage

use with koa:

var ABTest = ABTest();
var app = koa();

app.use(function* (next) {
  this.abtest = ABTest({
    getCookie: function () {},  // custom your getCookie method
    setCookie: function () {},  // custom your setCookie method
    query: this.query
  });
});

app.use(function* (next) {
  this.abtest.configure({
    bucket: {
      a: 9,
      b: 1
    },
    enableQuery: true,
    enableCookie: true
  });
});

app.use(function* (next) {
  this.body = this.abtest.bucket; // 10% a, 90% b
});

License

MIT

Keywords

FAQs

Last updated on 28 Jul 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc