1 | import {fileURLToPath} from 'node:url';
|
2 | import {Transform} from 'node:stream';
|
3 |
|
4 | export const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
5 |
|
6 | export class FilterStream extends Transform {
|
7 | constructor(filter) {
|
8 | super({
|
9 | objectMode: true,
|
10 | transform(data, encoding, callback) {
|
11 | callback(undefined, filter(data) ? data : undefined);
|
12 | },
|
13 | });
|
14 | }
|
15 | }
|
16 |
|
17 | export const isNegativePattern = pattern => pattern[0] === '!';
|