MCPcopy Create free account
hub / github.com/astercloud/aster / getParentPath

Function getParentPath

ui/src/protocol/path-resolver.ts:523–534  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

521 * @returns 父路径,如果是根路径则返回 null
522 */
523export function getParentPath(path: string): string | null {
524 if (!isValidJsonPointer(path) || path === '') {
525 return null;
526 }
527
528 const tokens = parseJsonPointer(path);
529 if (tokens.length === 0) {
530 return null;
531 }
532
533 return toJsonPointer(tokens.slice(0, -1));
534}
535
536/**
537 * 获取路径的最后一个段

Callers 1

Calls 3

isValidJsonPointerFunction · 0.85
parseJsonPointerFunction · 0.85
toJsonPointerFunction · 0.85

Tested by

no test coverage detected