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

abtest

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abtest

an A/B test client for node web

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
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

Package last updated on 28 Jul 2016

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc