Fixed PathEvents double slash
This commit is contained in:
parent
ce40b5b1e7
commit
ce2f32dd45
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.22.1",
|
"version": "0.22.2",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -25,7 +25,7 @@ export type Method = '*' | 'n' | 'c' | 'r' | 'u' | 'd' | 'x';
|
|||||||
* @param {string} args
|
* @param {string} args
|
||||||
* @return {PathEvent} Event object
|
* @return {PathEvent} Event object
|
||||||
*/
|
*/
|
||||||
export function PE(str: TemplateStringsArray, ...args: string[]) {
|
export function PE(str: TemplateStringsArray, ...args: any[]) {
|
||||||
const combined = [];
|
const combined = [];
|
||||||
for(let i = 0; i < str.length || i < args.length; i++) {
|
for(let i = 0; i < str.length || i < args.length; i++) {
|
||||||
if(str[i]) combined.push(str[i]);
|
if(str[i]) combined.push(str[i]);
|
||||||
@ -92,7 +92,7 @@ export class PathEvent {
|
|||||||
|
|
||||||
constructor(Event: string | PathEvent) {
|
constructor(Event: string | PathEvent) {
|
||||||
if(typeof Event == 'object') return Object.assign(this, Event);
|
if(typeof Event == 'object') return Object.assign(this, Event);
|
||||||
let [p, scope, method] = Event.split(':');
|
let [p, scope, method] = Event.replaceAll(/\/{2,}/g, '/').split(':');
|
||||||
if(!method) method = scope || '*';
|
if(!method) method = scope || '*';
|
||||||
if(p == '*' || !p && method == '*') {
|
if(p == '*' || !p && method == '*') {
|
||||||
p = '';
|
p = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user