Fixed PathEvents filter
All checks were successful
Build / Build NPM Project (push) Successful in 1m12s
Build / Tag Version (push) Successful in 12s
Build / Publish Documentation (push) Successful in 47s

This commit is contained in:
Zakary Timson 2025-02-04 21:35:31 -05:00
parent fe9fdb9384
commit 35c471eef4
3 changed files with 4 additions and 4 deletions

View File

@ -6,9 +6,9 @@
</head> </head>
<body> <body>
<script type="module"> <script type="module">
import {formatDate} from './dist/index.mjs'; import {PathEvent} from './dist/index.mjs';
console.log(formatDate('YYYY-01-01')); console.log(PathEvent.filter(['payments/ztimson:cr', 'logs/momentum:c', 'data/Testing:r'], 'data'));
</script> </script>
</body> </body>
</html> </html>

View File

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

View File

@ -142,7 +142,7 @@ 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 => f.fullPath.startsWith(t.fullPath) return !!parsedFind.find(f => t.fullPath.startsWith(f.fullPath)
&& (f.all || t.all || t.methods.intersection(f.methods).length)); && (f.all || t.all || t.methods.intersection(f.methods).length));
}); });
} }