@liplum/env
Version:
Reading and parsing environment variables from "process.env"
22 lines • 605 B
JavaScript
import str2bool from "@liplum/str2bool";
import { EnvMixin } from "./shared.js";
export class BoolEnv extends EnvMixin {
getOrNull = (options) => {
const raw = this.env.getOrNull();
if (raw === undefined) {
return this.getDefaultValue();
}
return str2bool(raw, {
strict: false,
...options
});
};
get = (options) => {
const result = this.getOrNull(options);
if (result === undefined) {
throw this.missingEnvError();
}
return result;
};
}
//# sourceMappingURL=bool.js.map