Version v0.4 of App Configuration Node SDK introduces a enhancement to return detailed information of the evaluation value as part of the getCurrentValue
method. Read this guide to understand the differences and what changes you should make in your application.
Call to getCurrentValue
will return the evaluated value of the feature flag. The type of the return value will match that of feature flag (Numeric/Boolean/String).
const feature = appConfigClient.getFeature('discount');
if (feature !== null) {
const result = feature.getCurrentValue(entityId, entityAttributes);
console.log(result) // Example output: 25
}
Call to getCurrentValue
will return an JSON object containing evaluated value, feature flag enabled status & evaluation details. The return type will always be an valid JSON object. The evaluated value, enabled status and evaluation details should be accessed using the (.) dot notation or ([]) bracket notation. See below
const feature = appConfigClient.getFeature('discount');
if (feature !== null) {
const result = feature.getCurrentValue(entityId, entityAttributes);
console.log(result.value) // Example output: 25
console.log(result.isEnabled) // Example output: true or false
console.log(result.details) // Example output: A JSON object containing detailed information of the evaluation.
}
// Dot notation: result.value
// Bracket notation: result['value']
In short, if you are already using the getCurrentValue
and are upgrading the SDK version from 0.3.x to 0.4.x then access the evaluated value from result.value
instead of just result
.
This change is applicable to properties as well.
See the release notes of each versions.