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

Function getLastToken

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

Source from the content-addressed store, hash-verified

540 * @returns 最后一个路径段,如果是根路径则返回 null
541 */
542export function getLastToken(path: string): string | null {
543 if (!isValidJsonPointer(path) || path === '') {
544 return null;
545 }
546
547 const tokens = parseJsonPointer(path);
548 if (tokens.length === 0) {
549 return null;
550 }
551
552 const lastToken = tokens[tokens.length - 1];
553 return lastToken !== undefined ? lastToken : null;
554}
555
556/**
557 * 合并两个路径

Callers 1

Calls 2

isValidJsonPointerFunction · 0.85
parseJsonPointerFunction · 0.85

Tested by

no test coverage detected