blob: 46dbded6ea2467747658ef525e9174075c95af65 [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001declare const junk: {
2 /**
3 Returns `true` if `filename` matches a junk file.
4 */
5 is(filename: string): boolean;
6
7 /**
8 Returns `true` if `filename` doesn't match a junk file.
9
10 @example
11 ```
12 import {promisify} from 'util';
13 import * as fs from 'fs';
14 import junk = require('junk');
15
16 const pReaddir = promisify(fs.readdir);
17
18 (async () => {
19 const files = await pReaddir('some/path');
20
21 console.log(files);
22 //=> ['.DS_Store', 'test.jpg']
23
24 console.log(files.filter(junk.not));
25 //=> ['test.jpg']
26 })();
27 ```
28 */
29 not(filename: string): boolean;
30
31 /**
32 Regex used for matching junk files.
33 */
34 readonly regex: RegExp;
35
36 // TODO: Remove this for the next major release
37 default: typeof junk;
38};
39
40export = junk;