Ref #1476
The issue is that a path command may have multiple arcs, and the space optimization was only applied to the first one. Modified a test to check it.
Co-authored-by: Josep del Río <joseprio@fb.com>
Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
Mocha doesn't have a lot of features provided by jest.
There is a great assertion library out of the box.
And the most cool feature is inline snapshots.
Mocha also hides errors which makes debugging a nightmare sometimes.
Ref https://github.com/svg/svgo/issues/32
Added `stringifyPathData` utility to produce small as possible path by
- matching leading moveto and line to commands (m -> l, M -> L)
- combining moveto and lineto commands
- avoiding space before decimal numbers if possible
Regexps are quite leaky for complex parsing. Regression tests caught
a few issues related to path parser.
In this diff I implemented the new spec-compliant parser which solves
2 regression cases and covers many edge cases hard to handle with
regexps.