Skip to content

Commit af10d08

Browse files
committed
encapsulated additional custom properties to parent field "custom"
1 parent a555442 commit af10d08

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

index.d.ts

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,37 @@
11
import { Stats } from 'fs';
22

33
declare function directoryTree(
4-
path: string,
5-
options ? : directoryTree.DirectoryTreeOptions,
6-
onEachFile ? : directoryTree.DirectoryTreeCallback,
7-
onEachDirectory ? : directoryTree.DirectoryTreeCallback,
4+
path: string,
5+
options?: directoryTree.DirectoryTreeOptions,
6+
onEachFile?: directoryTree.DirectoryTreeCallback,
7+
onEachDirectory?: directoryTree.DirectoryTreeCallback
88
): directoryTree.DirectoryTree;
99

1010
export as namespace directoryTree;
1111

1212
declare namespace directoryTree {
13-
export interface DirectoryTree {
14-
path: string;
15-
name: string;
16-
size: number;
17-
type: "directory" | "file";
18-
children ? : DirectoryTree[];
19-
extension?: string;
20-
isSymbolicLink?: boolean;
21-
[key: string]: any;
22-
}
23-
export interface DirectoryTreeOptions {
24-
normalizePath ? : boolean;
25-
exclude ? : RegExp | RegExp[];
26-
attributes ? : (keyof Stats | "type" | "extension")[];
27-
extensions ? : RegExp;
28-
followSymlink ? : boolean;
29-
}
30-
export type DirectoryTreeCallback = (item: DirectoryTree, path: string, stats: Stats) => void;
13+
export interface DirectoryTree {
14+
path: string;
15+
name: string;
16+
size: number;
17+
type: 'directory' | 'file';
18+
children?: DirectoryTree[];
19+
extension?: string;
20+
isSymbolicLink?: boolean;
21+
custom: { [key: string]: any };
22+
}
23+
export interface DirectoryTreeOptions {
24+
normalizePath?: boolean;
25+
exclude?: RegExp | RegExp[];
26+
attributes?: (keyof Stats | 'type' | 'extension')[];
27+
extensions?: RegExp;
28+
followSymlink?: boolean;
29+
}
30+
export type DirectoryTreeCallback = (
31+
item: DirectoryTree,
32+
path: string,
33+
stats: Stats
34+
) => void;
3135
}
3236

3337
export = directoryTree;

0 commit comments

Comments
 (0)