README
Confidence is a configuration document format, an API, and a foundation for A/B testing. The configuration format is designed to
work with any existing JSON-based configuration, serving values based on object path ('/a/b/c'
translates to a.b.c
). In addition,
confidence defines special $-prefixed keys used to filter values for a given criteria.
Version 5.x only supports node v12 and over. For older versions of node please use version 4.x.
Lead Maintainer: Sunny Bhanot
Example
{
"key1": "abc",
"key2": {
"$filter": "env",
"production": {
"deeper": {
"$value": "value"
}
},
"$default": {
"$filter": "platform",
"android": 0,
"ios": 1,
"$default": 2
}
},
"key3": {
"sub1": 123,
"sub2": {
"$filter": "xfactor",
"yes": 6
}
},
"ab": {
"$filter": "random.a",
"$range": [
{ "limit": 10, "value": 4 },
{ "limit": 20, "value": 5 }
],
"$default": 6
},
"$meta": {
"description": "example file"
}
}
Without any criteria applied, the above configuration document will result in the following:
{
"key1": "abc",
"key2": 2,
"key3": {
"sub1": 123
},
"ab": 6
}
With the following criteria applied:
{
"env": "production",
"platform": "ios",
"xfactor": "yes",
"random": {
"a": 15
}
}
The result is:
{
"key1": "abc",
"key2": {
"deeper": "value"
},
"key3": {
"sub1": 123,
"sub2": 6
},
"ab": 5
}
Document Format
Confidence builds on top of a Javascript object as its document.
Basic structure
The configuration document starts with a simple object. Key names can only contain alphanumeric characters and '_' with the '