export { Constants } from './constants'; export { IpcEvents } from './ipcEvents'; // Source: http://stackoverflow.com/questions/13720256/javascript-regex-camelcase-to-sentence export function camelCaseToSentence(camelCasedText: string): string { return camelCasedText.replace(/^[a-z]|[A-Z]/g, function (v, i) { return i === 0 ? v.toUpperCase() : ' ' + v.toLowerCase(); }); } export function capitalizeFirstLetter(text: string): string { return text.charAt(0).toUpperCase() + text.slice(1); } /** * This function coerces a string into a string literal type. * Using tagged union types in TypeScript 2.0, this enables * powerful typechecking of our reducers. * * Since every action label passes through this function it * is a good place to ensure all of our action labels * are unique. */ const typeCache: { [label: string]: boolean } = {}; export function type(label: T | ''): T { if (typeCache[label]) { throw new Error(`Action type "${label}" is not unique"`); } typeCache[label] = true; return label; } export function runInElectron() { return window && (window).process && (window).process.type; }