| 123456789101112131415161718192021222324252627282930313233343536 |
- import { each, isArray, isString } from 'lodash-es';
- var regexTags = /[MLHVQTCSAZ]([^MLHVQTCSAZ]*)/gi;
- var regexDot = /[^\s\,]+/gi;
- 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) {
- // @ts-ignore
- if (!isNaN(sub)) {
- // @ts-ignore
- item[i] = +sub;
- }
- });
- // @ts-ignore
- path[index] = item;
- });
- return path;
- }
- }
- export default parsePath;
- //# sourceMappingURL=parse-path.js.map
|