Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lucasliet/feature-flag-utils
Feature flag utils to handle whitelist or percentage
https://github.com/lucasliet/feature-flag-utils
Last synced: 16 days ago
JSON representation
Feature flag utils to handle whitelist or percentage
- Host: GitHub
- URL: https://github.com/lucasliet/feature-flag-utils
- Owner: lucasliet
- License: mit
- Created: 2022-06-25T18:27:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-06-28T16:55:56.000Z (over 2 years ago)
- Last Synced: 2024-12-29T06:11:38.258Z (27 days ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/feature-flag-util
- Size: 71.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Feature Flag Util
Utilities functions to deal with feature flags.## installation
```SH
yarn add feature-flag-util
```## usage
```TS
import * as FeatureFlag from 'feature-flag-util';const whitelistedCompanies = ['012345678910234', '432019876543210'];
FeatureFlag.isCompanyListed(whitelistedCompanies, '012345678910234'); // returns true
FeatureFlag.isCompanyListed(whitelistedCompanies, '654321043201987'); // returns false
FeatureFlag.isCompanyListedAsNumber(whitelistedCompanies, 12345678910234); // returns true
FeatureFlag.isRandomInPercentage(50); // returns true if random number generated is less than 50 otherwise, false
```> ℹ for JavaScript <= es5 use require
```JS
var FeatureFlag = require('feature-flag-util');
var result = FeatureFlag.isRandomInPercentage(50);
```