@beesley/ts-env
Version:
An environment variable reader for TypeScript
16 lines (15 loc) • 409 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = orThrow;
function orThrow(readFunction, type) {
return key => {
const value = readFunction(key);
if (value == null || type === 'string' && value === '') {
throw new Error(`Couldn't read ${type} value from process.env.${key}`);
}
return value;
};
}
//# sourceMappingURL=or-throw.cjs.map