MCPcopy Index your code
hub / github.com/nodejs/node / #normalizePath

Method #normalizePath

lib/internal/vfs/providers/memory.js:226–235  ·  view source on GitHub ↗

* Normalizes a path to use forward slashes, removes trailing slash, * and resolves . and .. components. * @param {string} path The path to normalize * @returns {string} Normalized path

(path)

Source from the content-addressed store, hash-verified

224 * @returns {string} Normalized path
225 */
226 #normalizePath(path) {
227 // Convert backslashes to forward slashes
228 let normalized = StringPrototypeReplaceAll(path, '\\', '/');
229 // Ensure absolute path
230 if (normalized[0] !== '/') {
231 normalized = '/' + normalized;
232 }
233 // Use path.posix.normalize to resolve . and ..
234 return pathPosix.normalize(normalized);
235 }
236
237 /**
238 * Splits a path into segments.

Callers 15

#resolveSymlinkTargetMethod · 0.95
#lookupEntryMethod · 0.95
openSyncMethod · 0.95
readdirSyncMethod · 0.95
mkdirSyncMethod · 0.95
rmdirSyncMethod · 0.95
unlinkSyncMethod · 0.95
renameSyncMethod · 0.95
linkSyncMethod · 0.95
readlinkSyncMethod · 0.95
symlinkSyncMethod · 0.95
watchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected