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

evolutio

v0.1.6

Published

ab testing framework

Downloads

26

Readme

Evolutio-logo

Evolutio

Frontend A\B testing framework with automated code removing of finished tests

Install

npm i evolutio -S

How to use

Terms

  • Mutation - single A\B test or a feature. Contains different genes
  • Gene - single test case or option. Contains a value or piece of code to run
  • DNA - current configuration for A\B test (Mutations). Could be generated dynamically for each runtime
  • Winners DNA - configuration with winner Genes. Used to remove outdated mutations

Example

For example we need to generate 2 different texts for selling button:

Generate our DNA. This could be done by external service. Let's put it into ./src/dna.js file:

export default {
  'sell-button-text': Math.random() > 0.5 ? 'aggressive' : 'normal'
};

Then we use this DNA in src/button.js file:

import evolutio from 'evolutio';
import dna from './dna';
const { Mutation } = evolutio(dna);

function button() {
  const buttonText = Mutation('sell-button-text')
    .gene('aggressive', 'BUY NOW!')
    .gene('normal', 'Buy')
    .value();

  return `<button>${buttonText}</button>`;
}

export default button;

Removing outdated tests

add a script to your package.json:

"clean:abtest": "evolutio -w ./winners.json -s ./src --no-dry"

Here ./src is the directory with your source code (please commit your changes before running this command). And winners.json is a file with winner genes, for example like this:

{
  "sell-button-text": "normal"
}

Then, if you run this command it will modify the code of src/button.js to be like this:

import evolutio from 'evolutio';
import dna from './dna';
const { Mutation } = evolutio(dna);

function button() {
  const buttonText = 'Buy'

  return `<button>${buttonText}</button>`;
}

export default button;

API

DNA

Object Key-value object. Represend a config for current runtime or winners config for removing.

Evolutio

Function Main package function. Expect to receive DNA and returns an object with Mutation function

evolutio(dna:DNA) -> {Mutation: Mutation}

Mutation

Function Mutation function expect to receive test name. Creates new MutationInstance:

Mutation(mutationName:String) -> MutationInstance

MutationInstance

Object with mutation methods:

gene

Add new gene to mutation. Expect gene name and gene value. Value could be any variable or function:

gene(geneName:String, geneValue:mixed) -> MutationInstance

value

Immediately returns a value of active gene according to DNA

value() -> mixed

run

Immediately invoke a function of active gene according to DNA. Like value, but calling a function and returns it's result

run() -> mixed

CLI

Options:
   -d, --dry       Dry run  [true]
   -p, --print     Print output
   -s, --src       path to directory to remove outdated mutations  [./src]
   -w, --winners   Winners DNA: a JSON file with winner mutations, key is a mutation name and value is a winner gene  []
   --version       print version and exit