15 lines
430 B
TypeScript
15 lines
430 B
TypeScript
|
/**
|
||
|
* Return true if we're in a browser environment (including web workers).
|
||
|
*/
|
||
|
export const isBrowserEnvironment = (): boolean => {
|
||
|
return typeof process === "undefined" || typeof process.stdout === "undefined";
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Escape a path. This prevents any issues with file names that have quotes,
|
||
|
* spaces, braces, etc.
|
||
|
*/
|
||
|
export const escapePath = (path: string): string => {
|
||
|
return `'${path.replace(/'/g, "'\\''")}'`;
|
||
|
};
|