Rocky_Mountain_Vending/.pnpm-store/v10/files/ae/ad44446c91c1e8d465b8de7a362c930a0178626844886a21386f0780f08ac097d1df366359976460ebeddc9caba9cf28740bdb1a99daec9681cf330b7a1855
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

28 lines
1 KiB
Text

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);
}
export { FALSY_ENV_VALUES, TRUTHY_ENV_VALUES, envToBool };
//# sourceMappingURL=envToBool.js.map