MCPcopy
hub / github.com/nestjs/nest / normalizePath

Function normalizePath

packages/common/utils/shared.utils.ts:33–38  ·  view source on GitHub ↗
(path?: string)

Source from the content-addressed store, hash-verified

31 : '';
32
33export const normalizePath = (path?: string): string =>
34 path
35 ? path.startsWith('/')
36 ? ('/' + path.replace(/\/+$/, '')).replace(/\/+/g, '/')
37 : '/' + path.replace(/\/+$/, '')
38 : '/';
39
40export const stripEndSlash = (path: string) =>
41 path[path.length - 1] === '/' ? path.slice(0, path.length - 1) : path;

Callers 4

initializeMethod · 0.90
flattenRoutePathsFunction · 0.90
addWsServerToRegistryMethod · 0.90

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected