跳到主要内容

parseLogicalPath()

function parseLogicalPath(path): readonly string[] | undefined;

Defined in: provider/logical-path.ts:46

把 wire 上的路径切成已校验的段。

Parameters​

ParameterTypeDescription
pathunknownwire 上的路径值;非字符串一律判非法。

Returns​

readonly string[] | undefined

校验通过的段序列,非法时为 undefined。

Remarks​

空路径合法,表示根目录。任何一段非法即整条非法——不做「跳过坏段继续走」的容错, 那会让 a/../b 悄悄解析成 a/b。连续斜杠产生的空段被丢弃(a//b 等价于 a/b), 因为它描述的是同一个位置,而不是一个额外的匿名层级。