@embrace-io/web-sdk
Version:
25 lines (24 loc) • 1.25 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_resources_constants_index = require("../resources/constants/index.cjs");
//#region src/sdk/utils.ts
const validateAppID = (appID) => {
if (appID === void 0) return void 0;
if (typeof appID !== "string") throw new Error(`appID must be a string, or omitted if not using Embrace. Received ${String(appID)}`);
if (appID.length !== 5) throw new Error(`appID should be 5 characters long, or omitted if not using Embrace. Received "${appID}"`);
return appID;
};
const validateAppVersion = (appVersion) => {
if (appVersion === void 0) {
const trimmedTemplate = require_resources_constants_index.TEMPLATE_APP_VERSION.trim();
if (trimmedTemplate === "") return "unspecified";
return trimmedTemplate;
}
if (typeof appVersion !== "string") throw new Error(`if appVersion is specified, it must be a string. Received ${String(appVersion)}`);
const trimmedAppVersion = appVersion.trim();
if (trimmedAppVersion === "") throw new Error("if appVersion is specified, it cannot be an empty string.");
return trimmedAppVersion;
};
//#endregion
exports.validateAppID = validateAppID;
exports.validateAppVersion = validateAppVersion;
//# sourceMappingURL=utils.cjs.map