@launchdarkly/js-server-sdk-common-edge
Version:
LaunchDarkly Server SDK for JavaScript - common Edge SDK code
31 lines • 1.35 kB
JavaScript
;
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
const validateOptions = (sdkKey, options) => {
const { featureStore, logger, sendEvents } = options, rest = __rest(options, ["featureStore", "logger", "sendEvents"]);
if (!sdkKey) {
throw new Error('You must configure the client with a client key');
}
if (!featureStore || typeof featureStore !== 'object' || !featureStore.get) {
throw new Error('You must configure the client with a feature store');
}
if (!logger) {
throw new Error('You must configure the client with a logger');
}
if (JSON.stringify(rest) !== '{}') {
throw new Error(`Invalid configuration: ${Object.keys(rest).toString()} not supported`);
}
return true;
};
exports.default = validateOptions;
//# sourceMappingURL=validateOptions.js.map