UNPKG

@splitsoftware/splitio-commons

Version:
21 lines (20 loc) 860 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isConsumerMode = exports.validateMode = void 0; var constants_1 = require("../constants"); function validateMode(key, mode) { // Leaving the comparison as is, in case we change the mode name but not the setting. if (key === 'localhost') return constants_1.LOCALHOST_MODE; if ([constants_1.STANDALONE_MODE, constants_1.PRODUCER_MODE, constants_1.CONSUMER_MODE, constants_1.CONSUMER_PARTIAL_MODE].indexOf(mode) === -1) throw Error('Invalid mode provided'); return mode; } exports.validateMode = validateMode; /** * Storage is async if mode is consumer or partial consumer */ function isConsumerMode(mode) { return constants_1.CONSUMER_MODE === mode || constants_1.CONSUMER_PARTIAL_MODE === mode; } exports.isConsumerMode = isConsumerMode;