@intlayer/config
Version:
Retrieve Intlayer configurations and manage environment variables for both server-side and client-side environments.
29 lines • 882 B
JavaScript
const getPlatform = () => {
if (typeof import.meta !== "undefined" && typeof import.meta.env !== "undefined" && typeof import.meta.env.VITE_INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "vite";
} else if (typeof process.env.NEXT_PUBLIC_INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "next";
} else if (typeof process.env.REACT_APP_INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "react_app";
} else if (typeof process.env.INTLAYER_DEFAULT_LOCALE !== "undefined") {
return "node";
}
return void 0;
};
const getPrefix = (platform) => {
switch (platform) {
case "next":
return "NEXT_PUBLIC_INTLAYER_";
case "vite":
return "VITE_INTLAYER_";
case "react_app":
return "REACT_APP_INTLAYER_";
default:
return "INTLAYER_";
}
};
export {
getPlatform,
getPrefix
};
//# sourceMappingURL=detectPlatform.mjs.map