Codemod verified
Regularly tested and maintained by our engineers and codemod expert community.
byCodemod
OpenFeature/Replace Feature Flag
Last update
Jan 10, 2025
This codemod replaces openFeature compatible feature flags with a static value provided by the user.
Codemod replaces following SDK calls: getBooleanValue
, getStringValue
, getNumberValue
, getObjectValue
.
The codemod accepts the following arguments:
key
: The key of the feature flag to be replaced.value
: The value to replace the feature flag with.
Example
Before
const theValue = getBooleanValue("the-key", true).value;console.log(getBooleanValue("the-key", false));if (theValue === true) {const someVar = useGate("other-gate1");const templateVar = `Hello, ${someVar}`;const concatVar = "Goodbye, " + someVar;}if (theValue) {console.log("theValue is truthy");}if (theValue === 3) {console.log("value var === 3");}const x = theValue ? 1 : 0;if (getBooleanValue("the-key", true).value === true) {console.log("obj.value === true");}if (getBooleanValue("the-key", true).value) {console.log("obj.value is truthy");}console.log(getBooleanValue("the-key", true).value);
After
console.log(true);const someVar = useGate("other-gate1");const templateVar = `Hello, ${someVar}`;const concatVar = "Goodbye, " + someVar;console.log("theValue is truthy");const x = 1;console.log("obj.value === true");console.log("obj.value is truthy");console.log(true);
Build custom codemods
Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community