/
cfg.ts
62 lines (53 loc) · 1.38 KB
/
cfg.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import pli from "./native-polars";
/**
* Configure polars; offers options for table formatting and more.
*/
export interface Config {
/** Use utf8 characters to print tables */
setUtf8Tables(): Config;
/** Use ascii characters to print tables */
setAsciiTables(): Config;
/** Set the number of character used to draw the table */
setTblWidthChars(width: number): Config;
/** Set the number of rows used to print tables */
setTblRows(n: number): Config;
/** Set the number of columns used to print tables */
setTblCols(n: number): Config;
/** Turn on the global string cache */
setGlobalStringCache(): Config;
/** Turn off the global string cache */
unsetGlobalStringCache(): Config;
}
/**
* @ignore
*/
export const Config: Config = {
setUtf8Tables() {
process.env["POLARS_FMT_NO_UTF8"] = undefined;
return this;
},
setAsciiTables() {
process.env["POLARS_FMT_NO_UTF8"] = "1";
return this;
},
setTblWidthChars(width) {
process.env["POLARS_TABLE_WIDTH"] = String(width);
return this;
},
setTblRows(n) {
process.env["POLARS_FMT_MAX_ROWS"] = String(n);
return this;
},
setTblCols(n) {
process.env["POLARS_FMT_MAX_COLS"] = String(n);
return this;
},
setGlobalStringCache() {
pli.toggleStringCache(true);
return this;
},
unsetGlobalStringCache() {
pli.toggleStringCache(false);
return this;
},
};