react-awesome-feature-toggles
Version:
Simple feature toggles for react and react router
27 lines (19 loc) • 887 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var featureConfig = {};
var isToggleEnabled = exports.isToggleEnabled = function isToggleEnabled(toggleName) {
if (featureConfig[toggleName]) {
return true;
}
return false;
};
var setFeatureConfig = exports.setFeatureConfig = function setFeatureConfig() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) !== 'object') {
throw new Error('Feature config has to be an object');
}
featureConfig = config;
};