Fixed PathEvents filter
This commit is contained in:
		| @@ -9,6 +9,7 @@ | |||||||
| 			import {PathEvent} from './dist/index.mjs'; | 			import {PathEvent} from './dist/index.mjs'; | ||||||
|  |  | ||||||
| 			console.log(PathEvent.filter(['payments/ztimson:cr', 'logs/momentum:c', 'data/Testing:r'], 'data')); | 			console.log(PathEvent.filter(['payments/ztimson:cr', 'logs/momentum:c', 'data/Testing:r'], 'data')); | ||||||
|  | 			console.log(PathEvent.filter(['data/Submissions/Test:r'], 'data/Submissions/Test/test.html')); | ||||||
| 		</script> | 		</script> | ||||||
| 	</body> | 	</body> | ||||||
| </html> | </html> | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
| 	"name": "@ztimson/utils", | 	"name": "@ztimson/utils", | ||||||
| 	"version": "0.23.10", | 	"version": "0.23.11", | ||||||
| 	"description": "Utility library", | 	"description": "Utility library", | ||||||
| 	"author": "Zak Timson", | 	"author": "Zak Timson", | ||||||
| 	"license": "MIT", | 	"license": "MIT", | ||||||
|   | |||||||
| @@ -142,8 +142,9 @@ export class PathEvent { | |||||||
| 		const parsedFind = makeArray(filter).map(pe => new PathEvent(pe)); | 		const parsedFind = makeArray(filter).map(pe => new PathEvent(pe)); | ||||||
| 		return parsedTarget.filter(t => { | 		return parsedTarget.filter(t => { | ||||||
| 			if(!t.fullPath && t.all) return true; | 			if(!t.fullPath && t.all) return true; | ||||||
| 			return !!parsedFind.find(f => t.fullPath.startsWith(f.fullPath) | 			return !!parsedFind.find(f => | ||||||
| 				&& (f.all || t.all || t.methods.intersection(f.methods).length)); | 				(t.fullPath.startsWith(f.fullPath) || f.fullPath.startsWith(t.fullPath)) && | ||||||
|  | 				(f.all || t.all || t.methods.intersection(f.methods).length)); | ||||||
| 		}); | 		}); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user