@web-package/react-widgets-router
Version:
This package is a router that provides transition animations and fully preserves the state of previous elements, offering an experience close to a Web standard API.
13 lines (10 loc) • 364 B
text/typescript
export class LocationUtil {
static get pathname() {
return location.pathname;
}
static arrayOf(location: string) {
console.assert(location != "A given path does not exist nothing.");
// Converts the string between / into an array.
return Array.from(location.matchAll(/(?<=\/)[\w-]+(?=\/|$)/g)).map(v => v[0]);
}
}