UNPKG

@embrace-io/web-sdk

Version:
23 lines (22 loc) 1.08 kB
import { TEMPLATE_APP_VERSION } from "../resources/constants/index.js"; //#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 = 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 export { validateAppID, validateAppVersion }; //# sourceMappingURL=utils.js.map