File tree 2 files changed +20
-2
lines changed
2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -11,11 +11,24 @@ export class Generator extends stream.Readable {
11
11
readonly options : Options ;
12
12
}
13
13
14
+ export type ColumnsFunctionArgs = {
15
+ options : Options ;
16
+ state : State ;
17
+ } ;
18
+ export type ColumnsFunction = ( args : ColumnsFunctionArgs ) => string ;
19
+
20
+ export type State = {
21
+ start_time : number ,
22
+ fixed_size_buffer : number ,
23
+ count_written : number ,
24
+ count_created : number ,
25
+ }
26
+
14
27
export interface Options extends stream . ReadableOptions {
15
28
/**
16
29
* Define the number of generated fields and the generation method.
17
30
*/
18
- columns ?: number | string [ ] ;
31
+ columns ?: number | ( string | ColumnsFunction ) [ ] ;
19
32
/**
20
33
* Set the field delimiter.
21
34
*/
Original file line number Diff line number Diff line change @@ -48,7 +48,12 @@ describe('API Types', () => {
48
48
it ( 'columns' , ( ) => {
49
49
const options : Options = { }
50
50
options . columns = 8
51
- options . columns = [ 'ascii' , 'bool' , 'int' ]
51
+ options . columns = [
52
+ "ascii" ,
53
+ "bool" ,
54
+ "int" ,
55
+ ( { options, state } ) => options . delimiter + "ok" + state . start_time ,
56
+ ] ;
52
57
} )
53
58
54
59
it ( 'delimiter' , ( ) => {
You can’t perform that action at this time.
0 commit comments