npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rollouter

v1.0.458

Published

Simple distributed feature flags/AB tests lib

Downloads

512

Readme

Rollouter

Cryptography based, feature toggle / AB-test library.

Rollouter helps to roll out new features in a smart way. It requires no server and can be set up on the fly. The Idea behind rollouter is to ship consistent AB-test test and feature toggle with the possibility to gradually increase audience reach. A user will not only consistent see the result of conduction. Also, the change of proportions will affect only users from 'A' bucket. A second important feature of rollouter is the different users will be directed to different splits on each experiment. So there is no such problem as showing new features only to a certain group of users.

Live demo

Try it on runkit https://runkit.com/vshuhaiev/rollouter-sample

Simple config playgound https://wix-incubator.github.io/rollouter/

Quick start

Install

npm i rollouter

Examples

Minimal config

Valid config for rollouter should have features field as an object with feature name as key and settings as value. The only mandatory field is default. In order to conduct an experiment, you should pass config and user ID to determine a user. It can be any string. Based on this string rollouter will make a decision, which split to apply.

import rollouter from 'rollouter';
const config = {
    features:{
        feature1:{
            default: true,
        },
         feature2:{
            default: false,
        },
    },
};

const configuredInstance = rollouter
    .config(config)

console.log(`withUser: ${configuredInstance.user('someUserId').conduct('feature1')}`); //true
console.log(`noUser: ${configuredInstance.conduct('feature2')}`); //false

50/50 Experiment

In the following case, 50% of users will receive old version, 20% and 30% for new value 1 and new value 2

import rollouter from 'rollouter';
const config = {
    features:{
        feature1: {
            default: 'old version',
            experiments: [{
                variants: [{
                    slice: 0.2,
                    value: 'new value 1',
                },{
                    slice: 0.3,
                    value: 'new value 2',
                }],
            }],
        },
    },
};

rollouter
    .config(config)
    .user('user.id')
    .conduct('feature1');

Include users by any parameter

In the following case, 50% of users will receive old version, 20% and 30% for new value 1 and new value 2

import rollouter from 'rollouter';
const config = {
    features:{
        FancyButton:{
            default: false,
            experiments: [{
               includes: {
                   geo: ["US","UK"]
               },
               exclude: {
                   registered: false,
               },
               variants: [{
                   slice: 0.1,
                   value: true,
                }]
            },{
                includes: {
                    eyes: 'blue',
                },
                variants: [{
                     slice: 1,
                     value: true,
                }]
            }]
        },
    },
};

rollouter
    .config(config)
    .user('user.id', {'geo': 'US', eyes:'brown', registered: true})
    .conduct('FancyButton');

A new feature will see 10% of users from USA and UK except unregistered and all users with blue eyes. Please note that we do not consider user registration with blue eyes.