20 lines
753 B
JavaScript
20 lines
753 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getEnvVariable = exports.parseNumber = exports.parseBooleanVariable = void 0;
|
|
function parseBooleanVariable(value) {
|
|
return value === 'false' || value === '0' ? false : !!value;
|
|
}
|
|
exports.parseBooleanVariable = parseBooleanVariable;
|
|
function parseNumber(value) {
|
|
const parsed = value === void 0 ? Number.NaN : Number.parseInt(value, 10);
|
|
if (Number.isNaN(parsed))
|
|
return null;
|
|
return parsed;
|
|
}
|
|
exports.parseNumber = parseNumber;
|
|
function getEnvVariable(varName, onVarEmpty = () => void 0) {
|
|
const envVarValue = process.env[varName];
|
|
return envVarValue === void 0 ? onVarEmpty() : envVarValue;
|
|
}
|
|
exports.getEnvVariable = getEnvVariable;
|