Files
react-editor-shopify/editor/lib/resolve-editor-path.ts
2026-05-02 09:18:15 -04:00

16 lines
370 B
TypeScript

const resolveEditorPath = (editorPath: string[] = []) => {
const hasPath = editorPath.length > 0;
const isEdit = hasPath ? editorPath[editorPath.length - 1] === "edit" : false;
return {
isEdit,
path: `/${(isEdit
? [...editorPath].slice(0, editorPath.length - 1)
: [...editorPath]
).join("/")}`,
};
};
export default resolveEditorPath;