@serenity-js/rest
Version:
Serenity/JS Screenplay Pattern library for interacting with REST and other HTTP-based services, supporting comprehensive API testing and blended testing scenarios
39 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnvironmentVariables = void 0;
class EnvironmentVariables {
env;
constructor(env = process.env) {
this.env = env;
}
isSet(name) {
return this.env[name] !== undefined;
}
get(name) {
return this.env[name];
}
find(name) {
const candidateNames = [
name,
name.toLocaleUpperCase(),
name.toLocaleLowerCase(),
];
for (const variableName of candidateNames) {
if (this.isSet(variableName)) {
return this.get(variableName);
}
}
return undefined;
}
findFirst(...names) {
for (const name of names) {
const found = this.find(name);
if (found) {
return found;
}
}
return undefined;
}
}
exports.EnvironmentVariables = EnvironmentVariables;
//# sourceMappingURL=EnvironmentVariables.js.map