path2js = (path) => {
  // @ts-expect-error legacy
  if (path.pathJS) {
    // @ts-expect-error legacy
    return path.pathJS;
  }
  /** @type {import('../lib/types.js').PathDataItem[]} */
  const pathData = []; // JS representation of the path data
  const newPathData = parsePathData(path.attributes.d);
  for (const { command, args } of newPathData) {
    pathData.push({ command, args });
  }
  // First moveto is actually absolute. Subsequent coordinates were separated above.
  if (pathData.length && pathData[0].command == 'm') {
    pathData[0].command = 'M';
  }
  // @ts-expect-error legacy
  path.pathJS = pathData;
  return pathData;
}
Convert path string to JS representation.

@param {import('../lib/types.js').XastElement} path
@returns {import('../lib/types.js').PathDataItem[]}