refactor(aio): add assertNotMissingOrEmpty() helper

This commit is contained in:
Georgios Kalpakas
2017-02-27 21:04:43 +02:00
committed by Chuck Jazdzewski
parent c8d87a936b
commit c5644e5a0d
8 changed files with 39 additions and 20 deletions

View File

@ -1,4 +1,10 @@
// Functions
export const assertNotMissingOrEmpty = (name: string, value: string | null | undefined) => {
if (!value) {
throw new Error(`Missing or empty required parameter '${name}'!`);
}
};
export const getEnvVar = (name: string, isOptional = false): string => {
const value = process.env[name];