From ce2f32dd4515a24270a0196149a0c64a36ca6a20 Mon Sep 17 00:00:00 2001 From: ztimson Date: Fri, 8 Nov 2024 18:49:11 -0500 Subject: [PATCH] Fixed PathEvents double slash --- package.json | 2 +- src/path-events.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 39e74c3..11ac613 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.22.1", + "version": "0.22.2", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/path-events.ts b/src/path-events.ts index 5311726..fa2219b 100644 --- a/src/path-events.ts +++ b/src/path-events.ts @@ -25,7 +25,7 @@ export type Method = '*' | 'n' | 'c' | 'r' | 'u' | 'd' | 'x'; * @param {string} args * @return {PathEvent} Event object */ -export function PE(str: TemplateStringsArray, ...args: string[]) { +export function PE(str: TemplateStringsArray, ...args: any[]) { const combined = []; for(let i = 0; i < str.length || i < args.length; i++) { if(str[i]) combined.push(str[i]); @@ -92,7 +92,7 @@ export class PathEvent { constructor(Event: string | PathEvent) { 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(p == '*' || !p && method == '*') { p = '';