@stryke/path
Version:
A package containing various utilities that expand the functionality of NodeJs's built-in `path` module
18 lines (16 loc) • 499 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
//#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
exports.cwd = cwd;