Files
railwaysystem/RuoYi-Vue/ruoyi-ui/node_modules2/@antv/path-util/esm/parse-path.js
T

35 lines
1021 B
JavaScript
Raw Normal View History

2026-09-10 15:40:10 +08:00
import { each, isArray, isString } from '@antv/util';
var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/ig;
var regexDot = /[^\s\,]+/ig;
function parsePath(p) {
var path = p || [];
if (isArray(path)) {
return path;
}
if (isString(path)) {
path = path.match(regexTags);
each(path, function (item, index) {
// @ts-ignore
item = item.match(regexDot);
if (item[0].length > 1) {
var tag = item[0].charAt(0);
// @ts-ignore
item.splice(1, 0, item[0].substr(1));
// @ts-ignore
item[0] = tag;
}
// @ts-ignore
each(item, function (sub, i) {
if (!isNaN(sub)) {
// @ts-ignore
item[i] = +sub;
}
});
// @ts-ignore
path[index] = item;
});
return path;
}
}
export default parsePath;
//# sourceMappingURL=parse-path.js.map