normalizePath()
Part of the @remotion/paths package.
Removes all relative coordinates from a path and converts them into absolute coordinates.
Returns a string if the path is valid:
import { normalizePath } from "@remotion/paths";
const normalizedPath = normalizePath ("M 50 50 l 100 0");
console .log (normalizedPath ); // "M 50 50 L 150 50"The function will throw if the path is invalid:
normalizePath ("remotion"); // Error: Malformed path data: ...Credits
Source code stems mostly from svg-path-reverse.