24 lines
978 B
JavaScript
24 lines
978 B
JavaScript
shadow$provide.module$node_modules$parse_svg_path$dist$index_cjs = function(global, require, module, exports) {
|
|
const length = {a:7, c:6, h:1, l:2, m:2, q:4, s:4, t:2, v:1, z:0}, segment = /([astvzqmhlc])([^astvzqmhlc]*)/gi, number = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
|
|
module.exports = function(path) {
|
|
const data = [];
|
|
path.replace(segment, (_, cmd, args) => {
|
|
_ = cmd.toLowerCase();
|
|
args = (args = args.match(number)) ? args.map(Number) : [];
|
|
"m" === _ && 2 < args.length && (data.push([cmd, ...args.splice(0, 2)]), _ = "l", cmd = "m" === cmd ? "l" : "L");
|
|
for (;;) {
|
|
if (args.length === length[_]) {
|
|
return data.push([cmd, ...args]), "";
|
|
}
|
|
if (args.length < length[_]) {
|
|
throw Error("malformed path data");
|
|
}
|
|
data.push([cmd, ...args.splice(0, length[_])]);
|
|
}
|
|
});
|
|
return data;
|
|
};
|
|
};
|
|
|
|
//# sourceMappingURL=module$node_modules$parse_svg_path$dist$index_cjs.js.map
|