diff --git a/src/scripts/helpers/titleCase.ts b/src/scripts/helpers/titleCase.ts new file mode 100644 index 0000000000..66a763f5d4 --- /dev/null +++ b/src/scripts/helpers/titleCase.ts @@ -0,0 +1,4 @@ +/** TitleCase all words in a string */ +export const toTitleCase = (str: string): string => { + return str.replace(/\w\S*/g, (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()); +}; diff --git a/src/scripts/preview/preview.ts b/src/scripts/preview/preview.ts index fc44a0ceb6..befed0a971 100644 --- a/src/scripts/preview/preview.ts +++ b/src/scripts/preview/preview.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import { toTitleCase } from '../../helpers'; +import { toTitleCase } from './../helpers/titleCase'; import { createScreenshot } from '../helpers/screenshots'; import * as painter from './../helpers/painter';