@craco/craco
Version:
Create React App Configuration Override, an easy and comprehensible configuration layer for create-react-app.
27 lines (21 loc) • 525 B
JavaScript
function when(condition, fct, unmetValue) {
if (condition) {
return fct();
}
return unmetValue;
}
function whenDev(fct, unmetValue) {
return when(process.env.NODE_ENV === "development", fct, unmetValue);
}
function whenProd(fct, unmetValue) {
return when(process.env.NODE_ENV === "production", fct, unmetValue);
}
function whenTest(fct, unmetValue) {
return when(process.env.NODE_ENV === "test", fct, unmetValue);
}
module.exports = {
when,
whenDev,
whenProd,
whenTest
};