storybook/lib/cli/src/utils.ts
2022-04-06 14:38:09 +08:00

17 lines
498 B
TypeScript

export function parseList(str: string): string[] {
return str
.split(',')
.map((item) => item.trim())
.filter((item) => item.length > 0);
}
export function getEnvConfig(program: Record<string, any>, configEnv: Record<string, any>): void {
Object.keys(configEnv).forEach((fieldName) => {
const envVarName = configEnv[fieldName];
const envVarValue = process.env[envVarName];
if (envVarValue) {
program[fieldName] = envVarValue; // eslint-disable-line
}
});
}