UNPKG

@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

35 lines 855 B
export 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; } } //# sourceMappingURL=EnvironmentVariables.js.map