0.1.12 • Published 4 years ago
featurize v0.1.12
Better Featurize documentation hopefully
coming soon!
Installation
npm install --save featurize
Usage
Import featurize
:
import { featurize } from 'featurize';
Create a featurize
instance:
import { features, filters, env } from './config';
const instance = featurize({
features,
filters,
env
});
featurize
accepts an object with 3 properties:
- features: an array of feature objects
- filters: an object with an
options
andstate
property - env: a string value to represent which feature version to use
feature
object:
This is a barebones feature object. There will be an explanation for each property below.
const feature = {
name: 'Feature',
versions: {},
states: [],
sections: [],
filters: {},
data: {}
};
name
:
A unique string
identifier for each particular feature
versions
:
An object
containing custom properties that explicitly references the env
property with custom properties each containing the value of a version string
, for example:
versions: {
dev: '3.4.9',
prod: '3.0.0'
}
or:
versions: {
someEnvName: 'beta',
anotherEnvName: 'alpha'
}
Version properties and values can be whatever you like, they just need to be used in conjunction with the library's API (a full detailed usage example will be provided).