Initial commit
This commit is contained in:
15
editor/lib/resolve-editor-path.ts
Normal file
15
editor/lib/resolve-editor-path.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user