UNPKG

jsx-email

Version:

Render JSX email components to HTML email

14 lines (9 loc) 408 B
import titleize from 'titleize'; export const addSpacesForCamelCaseName = (str: string) => str.replace(/([a-z])([A-Z])/g, '$1 $2'); export const parseName = (path: string) => { const chunks = path.replace('\\', '/').split('/'); const segment = chunks.at(-1); const [basename] = segment!.split(/\.[^.]+$/); return titleize(addSpacesForCamelCaseName(basename)); }; export const { warn } = console;