@beesley/ts-env
Version:
An environment variable reader for TypeScript
10 lines • 346 B
JavaScript
export default 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.js.map