MCPcopy Create free account
hub / github.com/breck7/scroll / normalize$1

Function normalize$1

external/.d3.js:13793–13798  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

13791// (as long as the trailing slash is not immediately preceded by another slash),
13792// and add leading slash if missing.
13793function normalize$1(path) {
13794 path = `${path}`;
13795 let i = path.length;
13796 if (slash(path, i - 1) && !slash(path, i - 2)) path = path.slice(0, -1);
13797 return path[0] === "/" ? path : `/${path}`;
13798}
13799
13800// Walk backwards to find the first slash that is not the leading slash, e.g.:
13801// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased

Callers 1

stratifyFunction · 0.85

Calls 2

slashFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected