详细说明: - 添加了V2版本的工作流页面和结果页面 - 更新了Serena记忆文件 - 添加了详细实施计划文档 - 优化了Vite配置 - 更新了项目文档CLAUDE.md - 构建了演示系统的dist版本 - 包含了exhibition-demo的完整依赖
33 lines
951 B
JavaScript
33 lines
951 B
JavaScript
/**
|
|
* Parse a path string into an array of path segments.
|
|
*
|
|
* Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
|
|
*
|
|
* Example:
|
|
* a -> ['a']
|
|
* a.b.c -> ['a', 'b', 'c']
|
|
* a[b].c -> ['a', 'b', 'c']
|
|
* a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
|
|
* a[b][c][d] -> ['a', 'b', 'c', 'd']
|
|
*
|
|
* @param {string|string[]} path
|
|
**/ "use strict";
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
Object.defineProperty(exports, "toPath", {
|
|
enumerable: true,
|
|
get: function() {
|
|
return toPath;
|
|
}
|
|
});
|
|
function toPath(path) {
|
|
if (Array.isArray(path)) return path;
|
|
let openBrackets = path.split("[").length - 1;
|
|
let closedBrackets = path.split("]").length - 1;
|
|
if (openBrackets !== closedBrackets) {
|
|
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
|
|
}
|
|
return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
|
|
}
|