Fixed PathEvents double slash
All checks were successful
Build / Build NPM Project (push) Successful in 1m10s
Build / Tag Version (push) Successful in 13s
Build / Publish Documentation (push) Successful in 1m54s

This commit is contained in:
Zakary Timson 2024-11-08 18:49:11 -05:00
parent ce40b5b1e7
commit ce2f32dd45
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ztimson/utils",
"version": "0.22.1",
"version": "0.22.2",
"description": "Utility library",
"author": "Zak Timson",
"license": "MIT",

View File

@ -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 = '';