https://github.com/mderazon/ab-group
Generate ab-groups from user ids for your a/b tests
https://github.com/mderazon/ab-group
ab-testing
Last synced: 6 months ago
JSON representation
Generate ab-groups from user ids for your a/b tests
- Host: GitHub
- URL: https://github.com/mderazon/ab-group
- Owner: mderazon
- Created: 2022-01-04T10:15:32.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-04T10:24:15.000Z (over 4 years ago)
- Last Synced: 2025-10-21T09:44:06.541Z (9 months ago)
- Topics: ab-testing
- Language: JavaScript
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ab-group
[](https://github.com/mderazon/ab-group/actions) [](https://github.com/prettier/prettier)
> Easily generate ab-groups from user ids for your a/b tests
## Usage
```js
const abGroup = require("ab-group");
abGroup("usr_ZvKYlo2C0PT9H6G5"); // returns 0
abGroup("usr_1032D82eZvKYlo2C"); // returns 1
```
## Behavior
1. Deterministic - Given the same input, it will always output the same group.
2. Random - It is not biased towards any of the groups. This is under the assumption that **your ids are randomly generated**.
## API
```js
abGroup(id, groups);
```
- `id`: **mandatory**. An ID (or any string) to calculate the a/b group from.
- `groups`: **optional**. Number of groups. Defaults for 2 groups (A/B) but you can use it to generate more groups.