Files
klz-cables.com/.pnpm-store/v10/files/38/422894d831e4507b2af46e48047b95aec31985f28f9dd850c7b1e508aa3ace2c7c56385e0288a90c9ddd09f7c2e330c913b48f6d90067da6336cf7f3ddb7ab
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

33 lines
1.2 KiB
Plaintext

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const FALSY_ENV_VALUES = new Set(['false', 'f', 'n', 'no', 'off', '0']);
const TRUTHY_ENV_VALUES = new Set(['true', 't', 'y', 'yes', 'on', '1']);
/**
* A helper function which casts an ENV variable value to `true` or `false` using the constants defined above.
* In strict mode, it may return `null` if the value doesn't match any of the predefined values.
*
* @param value The value of the env variable
* @param options -- Only has `strict` key for now, which requires a strict match for `true` in TRUTHY_ENV_VALUES
* @returns true/false if the lowercase value matches the predefined values above. If not, null in strict mode,
* and Boolean(value) in loose mode.
*/
function envToBool(value, options) {
const normalized = String(value).toLowerCase();
if (FALSY_ENV_VALUES.has(normalized)) {
return false;
}
if (TRUTHY_ENV_VALUES.has(normalized)) {
return true;
}
return options?.strict ? null : Boolean(value);
}
exports.FALSY_ENV_VALUES = FALSY_ENV_VALUES;
exports.TRUTHY_ENV_VALUES = TRUTHY_ENV_VALUES;
exports.envToBool = envToBool;
//# sourceMappingURL=envToBool.js.map