From 1b5e16ae5f950dc0e9ef0c5342e27c5cba2e1c33 Mon Sep 17 00:00:00 2001 From: ztimson Date: Fri, 16 Jan 2026 18:07:32 -0500 Subject: [PATCH] Added parent dir helper to path events --- package.json | 2 +- src/path-events.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0e0e53e..7927ca8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ztimson/utils", - "version": "0.28.4", + "version": "0.28.5", "description": "Utility library", "author": "Zak Timson", "license": "MIT", diff --git a/src/path-events.ts b/src/path-events.ts index eef6043..2822280 100644 --- a/src/path-events.ts +++ b/src/path-events.ts @@ -65,6 +65,8 @@ export class PathEvent { module!: string; /** Entire path, including the module & name */ fullPath!: string; + /** Parent directory, excludes module & name */ + dir!: string; /** Path including the name, excluding the module */ path!: string; /** Last segment of path */ @@ -121,6 +123,7 @@ export class PathEvent { if(p === '' || p === undefined || p === '*') { this.module = ''; this.path = ''; + this.dir = ''; this.fullPath = '**'; this.name = ''; this.methods = new ASet(p === '*' ? ['*'] : method.split('')); @@ -132,6 +135,7 @@ export class PathEvent { let temp = p.split('/').filter(p => !!p); this.module = temp.splice(0, 1)[0] || ''; this.path = temp.join('/'); + this.dir = temp.length > 2 ? temp.slice(0, -1).join('/') : ''; this.fullPath = `${this.module}${this.module && this.path ? '/' : ''}${this.path}`; this.name = temp.pop() || ''; this.hasGlob = this.fullPath.includes('*');