| 1588 | |
| 1589 | // Convert arrays to named objects |
| 1590 | export const arrayCommandsToObjects = commands => commands.map(command => { |
| 1591 | const type = command[0]; |
| 1592 | switch (type) { |
| 1593 | case 'Z': { |
| 1594 | return { type }; |
| 1595 | } |
| 1596 | case 'M': |
| 1597 | case 'L': { |
| 1598 | const [, x, y] = command; |
| 1599 | return { type, x, y }; |
| 1600 | } |
| 1601 | case 'Q': { |
| 1602 | const [, x1, y1, x, y] = command; |
| 1603 | return { type, x1, y1, x, y }; |
| 1604 | } |
| 1605 | case 'C': { |
| 1606 | const [, x1, y1, x2, y2, x, y] = command; |
| 1607 | return { type, x1, y1, x2, y2, x, y }; |
| 1608 | } |
| 1609 | default: { |
| 1610 | throw new Error(`Unexpected path command: ${type}`); |
| 1611 | } |
| 1612 | } |
| 1613 | }); |
| 1614 | |
| 1615 | export { sanitizeFontName as _sanitizeFontName }; |
| 1616 | export default font; |
no outgoing calls
no test coverage detected