Fixed PathEvents filter
All checks were successful
Build / Build NPM Project (push) Successful in 38s
Build / Tag Version (push) Successful in 7s
Build / Publish Documentation (push) Successful in 35s

This commit is contained in:
Zakary Timson 2025-02-04 22:17:31 -05:00
parent 35c471eef4
commit f755d8f5b8
3 changed files with 5 additions and 3 deletions

View File

@ -9,6 +9,7 @@
import {PathEvent} from './dist/index.mjs';
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>
</body>
</html>

View File

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

View File

@ -142,8 +142,9 @@ export class PathEvent {
const parsedFind = makeArray(filter).map(pe => new PathEvent(pe));
return parsedTarget.filter(t => {
if(!t.fullPath && t.all) return true;
return !!parsedFind.find(f => t.fullPath.startsWith(f.fullPath)
&& (f.all || t.all || t.methods.intersection(f.methods).length));
return !!parsedFind.find(f =>
(t.fullPath.startsWith(f.fullPath) || f.fullPath.startsWith(t.fullPath)) &&
(f.all || t.all || t.methods.intersection(f.methods).length));
});
}