@stryke/path
Version:
A package containing various utilities that expand the functionality of NodeJs's built-in `path` module
17 lines (16 loc) • 455 B
JavaScript
//#region src/cwd.ts
/**
* Get the current working directory.
*
* @remarks
* This function attempts to retrieve the current working directory using `process.cwd()`.
*
* @returns The current working directory or '/' if it cannot be determined
*/
function cwd() {
if (typeof process !== "undefined" && typeof process.cwd === "function") return process.cwd().replace(/\\/g, "/");
return "/";
}
//#endregion
export { cwd };
//# sourceMappingURL=cwd.mjs.map