path.serialize()

Return the path represented as a path data string.

Whenever a Path object needs to be converted to a string for the SVG d attribute, this function should be used. Unlike the path.toString() function, this function checks whether the path data string is valid. The function throws an error if the path is not valid. This happens if the path has segments but does not start with a Moveto segment. Note that an empty string is valid, according to the SVG specification.

new g.Path('M 150 100 L 100 100 C 100 100 0 150 100 200 Z').serialize() = "M 150 100 L 100 100 C 100 100 0 150 100 200 Z"