Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
dist
node_modules
package-lock.json
15 changes: 10 additions & 5 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
import { isNull } from "./utils/isNull";
import { isString } from "./utils/isString";

Expand Down Expand Up @@ -58,7 +59,7 @@ const Route = function (
};

const getPath = (arg: Argument): string => {
let newPath = `${this.basePath}${this.path}`;
let newPath = `${this.basePath}/${this.path}`;

newPath += getArgPath(arg);

Expand All @@ -69,13 +70,17 @@ const Route = function (

updateChildren(this.path);

return (arg: Argument = '') => ({
const routeReturn = (arg: Argument = '') => ({
...this,
path: getPath(arg),
setBase,
toString: () => getPath(arg),
});

Object.assign(routeReturn, this, {path: getPath(), setBase, toString: () => getPath()});

return routeReturn;

} as any;

export {
Route,
};
export { Route };
77 changes: 77 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.