import fs from 'fs' export const checkExistence = (path: string): boolean => { return fs.existsSync(process.cwd() + path) } export const checkIfDirExistElseMakeDir = (path: string): void => { if (path) { const dir = checkExistence(path) if (!dir) { fs.mkdirSync(process.cwd() + path, { recursive: true }) } } } export function checkAnswerYes(answer: string): boolean { return answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y' } export function isEmail(email: string): boolean { const re = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/ return re.test(String(email).toLowerCase()) }