Innovenergy_trunk/frontend/node_modules/testcafe-reporter-dashboard/lib/env/utils.js

20 lines
753 B
JavaScript
Raw Permalink Normal View History

"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;