mirror of
https://github.com/penpot/penpot.git
synced 2026-04-28 04:38:14 +00:00
✨ Add path parser js impl more resilent to parse errors
This commit is contained in:
parent
36b5ca7313
commit
77472aabea
@ -916,11 +916,21 @@ function simplifyPathData(pdata) {
|
||||
export function parse(string) {
|
||||
if (!string || string.length === 0) return [];
|
||||
|
||||
var source = new Parser(string);
|
||||
var result = Array.from(source);
|
||||
try {
|
||||
var source = new Parser(string);
|
||||
var result = Array.from(source);
|
||||
|
||||
result = absolutizePathData(result);
|
||||
result = simplifyPathData(result);
|
||||
result = absolutizePathData(result);
|
||||
result = simplifyPathData(result);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
} catch (cause) {
|
||||
const msg = "unexpected exception parsing path";
|
||||
console.group(msg);
|
||||
console.log(`string: ${string}`)
|
||||
console.error(cause);
|
||||
console.groupEnd(msg);
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user