https://github.com/lifeomic/gradual-feature-toggle-tools
Provides a set of helper functions to make gradual, non-binary, feature toggle use easier
https://github.com/lifeomic/gradual-feature-toggle-tools
feature-toggle team-infra
Last synced: about 1 year ago
JSON representation
Provides a set of helper functions to make gradual, non-binary, feature toggle use easier
- Host: GitHub
- URL: https://github.com/lifeomic/gradual-feature-toggle-tools
- Owner: lifeomic
- Created: 2018-12-19T15:38:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-11-20T09:01:04.000Z (over 1 year ago)
- Last Synced: 2025-04-22T15:55:30.651Z (about 1 year ago)
- Topics: feature-toggle, team-infra
- Language: TypeScript
- Size: 898 KB
- Stars: 3
- Watchers: 21
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gradual-feature-toggle-tools
[](https://www.npmjs.com/package/@lifeomic/gradual-feature-toggle-tools)
[](https://travis-ci.org/lifeomic/gradual-feature-toggle-tools)
[](https://greenkeeper.io/)
A set of tools to make gradual rollout of features easier. For a real world story of how this can be used, checkout https://medium.com/lifeomic/changing-production-databases-with-confidence-and-without-downtime-c5f5d60061d7
## Selecting users to get a feature
When a new feature is being rolled out and is currently 50% enabled, then
ideally 50% of the users would get the new behavior. The enablement of the new
behavior should be uniform as the feature value is increased and should not be
biased by the usernames or feature names. For example, if you use e-mail
addresses then ideally the enablement of `@gmail.com` users would be evenly
spread across the range of enablement. The testcases assert that uniform
distribution is true.
Given a feature an a user, this code can help you decide whether a user should
receive the new behavior or not:
```js
import { calculateUserEnablementThreshold } from 'gradual-feature-toggle-tools';
const featureValue = // some lookup of a feature's current value (from 0 - 100)
const userThreshold = await calculateUserEnablementThreshold('some-feature', 'some-user');
if (featureValue > userThredshold) {
// Use the new behavior
} else {
// Use the old behavior
}
```