MCPcopy Create free account
hub / github.com/breck7/scroll / parentof

Function parentof

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

Source from the content-addressed store, hash-verified

13801// "/foo/bar" ⇥ "/foo", "/foo" ⇥ "/", "/" ↦ "". (The root is special-cased
13802// because the id of the root must be a truthy value.)
13803function parentof(path) {
13804 let i = path.length;
13805 if (i < 2) return "";
13806 while (--i > 1) if (slash(path, i)) break;
13807 return path.slice(0, i);
13808}
13809
13810// Slashes can be escaped; to determine whether a slash is a path delimiter, we
13811// count the number of preceding backslashes escaping the forward slash: an odd

Callers 1

stratifyFunction · 0.85

Calls 2

slashFunction · 0.85
sliceMethod · 0.80

Tested by

no test coverage detected