@ohos-ports/nodejs-polars 0.23.4-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +19 -0
  2. package/README.md +217 -0
  3. package/bin/cfg.d.ts +156 -0
  4. package/bin/cfg.js +52 -0
  5. package/bin/dataframe.d.ts +2135 -0
  6. package/bin/dataframe.js +783 -0
  7. package/bin/datatypes/conversion.d.ts +2 -0
  8. package/bin/datatypes/conversion.js +2 -0
  9. package/bin/datatypes/datatype.d.ts +285 -0
  10. package/bin/datatypes/datatype.js +430 -0
  11. package/bin/datatypes/field.d.ts +26 -0
  12. package/bin/datatypes/field.js +36 -0
  13. package/bin/datatypes/index.d.ts +43 -0
  14. package/bin/datatypes/index.js +120 -0
  15. package/bin/error.d.ts +7 -0
  16. package/bin/error.js +17 -0
  17. package/bin/functions.d.ts +26 -0
  18. package/bin/functions.js +208 -0
  19. package/bin/groupby.d.ts +212 -0
  20. package/bin/groupby.js +156 -0
  21. package/bin/html.d.ts +4 -0
  22. package/bin/html.js +18 -0
  23. package/bin/index.d.ts +256 -0
  24. package/bin/index.js +267 -0
  25. package/bin/internals/construction.d.ts +7 -0
  26. package/bin/internals/construction.js +256 -0
  27. package/bin/internals/polars_internal.d.ts +2 -0
  28. package/bin/internals/polars_internal.js +7 -0
  29. package/bin/io.d.ts +433 -0
  30. package/bin/io.js +344 -0
  31. package/bin/lazy/dataframe.d.ts +785 -0
  32. package/bin/lazy/dataframe.js +427 -0
  33. package/bin/lazy/expr/datetime.d.ts +8 -0
  34. package/bin/lazy/expr/datetime.js +27 -0
  35. package/bin/lazy/expr/index.d.ts +1152 -0
  36. package/bin/lazy/expr/index.js +632 -0
  37. package/bin/lazy/expr/list.d.ts +8 -0
  38. package/bin/lazy/expr/list.js +115 -0
  39. package/bin/lazy/expr/string.d.ts +534 -0
  40. package/bin/lazy/expr/string.js +131 -0
  41. package/bin/lazy/expr/struct.d.ts +126 -0
  42. package/bin/lazy/expr/struct.js +26 -0
  43. package/bin/lazy/functions.d.ts +612 -0
  44. package/bin/lazy/functions.js +687 -0
  45. package/bin/lazy/groupby.d.ts +29 -0
  46. package/bin/lazy/groupby.js +30 -0
  47. package/bin/lazy/index.d.ts +4 -0
  48. package/bin/lazy/index.js +20 -0
  49. package/bin/lazy/whenthen.d.ts +67 -0
  50. package/bin/lazy/whenthen.js +81 -0
  51. package/bin/native-polars.d.ts +2 -0
  52. package/bin/native-polars.js +267 -0
  53. package/bin/series/datetime.d.ts +8 -0
  54. package/bin/series/datetime.js +34 -0
  55. package/bin/series/index.d.ts +1135 -0
  56. package/bin/series/index.js +700 -0
  57. package/bin/series/list.d.ts +8 -0
  58. package/bin/series/list.js +87 -0
  59. package/bin/series/string.d.ts +300 -0
  60. package/bin/series/string.js +125 -0
  61. package/bin/series/struct.d.ts +36 -0
  62. package/bin/series/struct.js +35 -0
  63. package/bin/shared_traits.d.ts +1458 -0
  64. package/bin/shared_traits.js +2 -0
  65. package/bin/sql.d.ts +244 -0
  66. package/bin/sql.js +63 -0
  67. package/bin/types.d.ts +287 -0
  68. package/bin/types.js +2 -0
  69. package/bin/utils.d.ts +38 -0
  70. package/bin/utils.js +69 -0
  71. package/package.json +45 -0
package/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2020 Ritchie Vink
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # Polars
2
+
3
+ Polars: Blazingly fast DataFrames in Rust, Python, Node.js, R and SQL
4
+
5
+ [![rust docs](https://github.com/pola-rs/nodejs-polars/actions/workflows/docs.yaml/badge.svg)](https://github.com/pola-rs/nodejs-polars/actions/workflows/docs.yaml/)
6
+ [![Build and test](https://github.com/pola-rs/nodejs-polars/actions/workflows/test-js.yaml/badge.svg)](https://github.com/pola-rs/nodejs-polars/actions/workflows/test-js.yaml)
7
+ [![](https://img.shields.io/crates/v/polars.svg)](https://crates.io/crates/polars)
8
+ [![PyPI Latest Release](https://img.shields.io/pypi/v/polars.svg)](https://pypi.org/project/polars/)
9
+ [![NPM Latest Release](https://img.shields.io/npm/v/nodejs-polars.svg)](https://www.npmjs.com/package/nodejs-polars)
10
+
11
+ Documentation: [Node.js](https://pola-rs.github.io/nodejs-polars/index.html)
12
+ -[ Rust](https://docs.rs/polars/latest/polars/)
13
+ -[ Python](https://pola-rs.github.io/polars/py-polars/html/reference/index.html)
14
+ -[ R](https://rpolars.github.io/index.html)
15
+ |StackOverflow: [ Node.js](https://stackoverflow.com/questions/tagged/nodejs-polars)
16
+ -[ Rust](https://stackoverflow.com/questions/tagged/rust-polars)
17
+ -[ Python](https://stackoverflow.com/questions/tagged/python-polars)
18
+ | [User Guide](https://pola-rs.github.io/polars/)
19
+ | [Discord](https://discord.gg/4UfP5cfBE7)
20
+
21
+ #### Note: This library is intended to work only with server side JS/TS (Node, Bun, Deno). For browser please see [js-polars](https://github.com/pola-rs/js-polars)
22
+
23
+ ## Usage
24
+
25
+ ### Importing
26
+
27
+ ```js
28
+ // esm
29
+ import pl from 'nodejs-polars';
30
+
31
+ // require
32
+ const pl = require('nodejs-polars');
33
+ ```
34
+
35
+ ### Series
36
+
37
+ ```js
38
+ > const fooSeries = pl.Series("foo", [1, 2, 3])
39
+ > fooSeries.sum()
40
+ 6
41
+
42
+ // a lot operations support both positional and named arguments
43
+ // you can see the full specs in the docs or the type definitions
44
+ > fooSeries.sort(true)
45
+ > fooSeries.sort({descending: true})
46
+ shape: (3,)
47
+ Series: 'foo' [f64]
48
+ [
49
+ 3
50
+ 2
51
+ 1
52
+ ]
53
+ > fooSeries.toArray()
54
+ [1, 2, 3]
55
+
56
+ // Series are 'Iterables' so you can use javascript iterable syntax on them
57
+ > [...fooSeries]
58
+ [1, 2, 3]
59
+
60
+ > fooSeries[0]
61
+ 1
62
+
63
+ ```
64
+
65
+ ### DataFrame
66
+
67
+ ```js
68
+ >const df = pl.DataFrame(
69
+ ... {
70
+ ... A: [1, 2, 3, 4, 5],
71
+ ... fruits: ["banana", "banana", "apple", "apple", "banana"],
72
+ ... B: [5, 4, 3, 2, 1],
73
+ ... cars: ["beetle", "audi", "beetle", "beetle", "beetle"],
74
+ ... }
75
+ ... )
76
+ > df.sort("fruits").select(
77
+ ... "fruits",
78
+ ... "cars",
79
+ ... pl.lit("fruits").alias("literal_string_fruits"),
80
+ ... pl.col("B").filter(pl.col("cars").eq(pl.lit("beetle"))).sum(),
81
+ ... pl.col("A").filter(pl.col("B").gt(2)).sum().over("cars").alias("sum_A_by_cars"),
82
+ ... pl.col("A").sum().over("fruits").alias("sum_A_by_fruits"),
83
+ ... pl.col("A").reverse().over("fruits").flatten().alias("rev_A_by_fruits")
84
+ ... )
85
+ shape: (5, 8)
86
+ ┌──────────┬──────────┬──────────────┬─────┬─────────────┬─────────────┬─────────────┐
87
+ │ fruits ┆ cars ┆ literal_stri ┆ B ┆ sum_A_by_ca ┆ sum_A_by_fr ┆ rev_A_by_fr │
88
+ │ --- ┆ --- ┆ ng_fruits ┆ --- ┆ rs ┆ uits ┆ uits │
89
+ │ str ┆ str ┆ --- ┆ i64 ┆ --- ┆ --- ┆ --- │
90
+ │ ┆ ┆ str ┆ ┆ i64 ┆ i64 ┆ i64 │
91
+ ╞══════════╪══════════╪══════════════╪═════╪═════════════╪═════════════╪═════════════╡
92
+ │ "apple" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 7 ┆ 4 │
93
+ ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
94
+ │ "apple" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 7 ┆ 3 │
95
+ ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
96
+ │ "banana" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 8 ┆ 5 │
97
+ ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
98
+ │ "banana" ┆ "audi" ┆ "fruits" ┆ 11 ┆ 2 ┆ 8 ┆ 2 │
99
+ ├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌┤
100
+ │ "banana" ┆ "beetle" ┆ "fruits" ┆ 11 ┆ 4 ┆ 8 ┆ 1 │
101
+ └──────────┴──────────┴──────────────┴─────┴─────────────┴─────────────┴─────────────┘
102
+ ```
103
+
104
+ ```js
105
+ > df["cars"] // or df.getColumn("cars")
106
+ shape: (5,)
107
+ Series: 'cars' [str]
108
+ [
109
+ "beetle"
110
+ "beetle"
111
+ "beetle"
112
+ "audi"
113
+ "beetle"
114
+ ]
115
+ ```
116
+
117
+ ## Node setup
118
+
119
+ Install the latest polars version with:
120
+
121
+ ```sh
122
+ $ yarn add nodejs-polars # yarn
123
+ $ npm i -s nodejs-polars # npm
124
+ $ bun i -D nodejs-polars # Bun
125
+ ```
126
+
127
+ Releases happen quite often (weekly / every few days) at the moment, so updating polars regularly to get the latest bugfixes / features might not be a bad idea.
128
+
129
+ ### Minimum Requirements
130
+ - Node version `>=18`
131
+ - Rust version `>=1.86` - *Only needed for development*
132
+
133
+
134
+ ## Deno
135
+
136
+ In Deno modules you can import polars straight from `npm`:
137
+
138
+ ```typescript
139
+ import pl from "npm:nodejs-polars";
140
+ ```
141
+
142
+ With Deno 1.37, you can use the `display` function to display a `DataFrame` in the notebook:
143
+
144
+ ```typescript
145
+ import pl from "npm:nodejs-polars";
146
+ import { display } from "https://deno.land/x/display@v1.1.2/mod.ts";
147
+
148
+ let response = await fetch(
149
+ "https://cdn.jsdelivr.net/npm/world-atlas@1/world/110m.tsv",
150
+ );
151
+ let data = await response.text();
152
+ let df = pl.readCSV(data, { sep: "\t" });
153
+ await display(df)
154
+ ```
155
+
156
+ With Deno 1.38, you only have to make the dataframe be the last expression in the cell:
157
+
158
+ ```typescript
159
+ import pl from "npm:nodejs-polars";
160
+ let response = await fetch(
161
+ "https://cdn.jsdelivr.net/npm/world-atlas@1/world/110m.tsv",
162
+ );
163
+ let data = await response.text();
164
+ let df = pl.readCSV(data, { sep: "\t" });
165
+ df
166
+ ```
167
+
168
+ <img width="510" alt="image" src="https://github.com/pola-rs/nodejs-polars/assets/836375/90cf7bf4-7478-4919-b297-f8eb6a16196f">
169
+
170
+
171
+ ___
172
+
173
+ ## Documentation
174
+
175
+ Want to know about all the features Polars supports? Read the [docs](https://docs.pola.rs)!
176
+
177
+ #### Python
178
+
179
+ - Installation guide: `$ pip3 install polars`
180
+ - [Python documentation](https://pola-rs.github.io/polars/py-polars/html/reference/index.html)
181
+ - [User guide](https://docs.pola.rs)
182
+
183
+ #### Rust
184
+
185
+ - [Rust documentation](https://docs.rs/polars/latest/polars/)
186
+
187
+ #### Node
188
+
189
+ * Installation guide: `$ yarn add nodejs-polars` or `$ bun install nodejs-polars`
190
+ * [Node documentation](https://pola-rs.github.io/nodejs-polars/)
191
+
192
+ ## Contribution
193
+
194
+ Want to contribute? Read our [contribution guideline](https://github.com/pola-rs/polars/blob/master/CONTRIBUTING.md).
195
+
196
+ ## \[Node\]: compile polars from source
197
+
198
+ If you want a bleeding edge release or maximal performance you should compile **polars** from source.
199
+
200
+ 1. Install the latest [Rust compiler](https://www.rust-lang.org/tools/install)
201
+ 2. Run `npm|yarn install`
202
+ 3. Choose any of:
203
+ - Fastest binary, very long compile times:
204
+ ```bash
205
+ $ cd nodejs-polars && yarn build && yarn build:ts # this will generate a /bin directory with the compiles TS code, as well as the rust binary
206
+ ```
207
+ - Debugging, fastest compile times but slow & large binary:
208
+ ```bash
209
+ $ cd nodejs-polars && yarn build:debug && yarn build:ts # this will generate a /bin directory with the compiles TS code, as well as the rust binary
210
+ ```
211
+
212
+ ## Webpack configuration
213
+ To use `nodejs-polars` with [Webpack](https://webpack.js.org) please use [node-loader](https://github.com/webpack-contrib/node-loader) and `webpack.config.js`
214
+
215
+ ## Sponsors
216
+
217
+ [<img src="https://www.jetbrains.com/company/brand/img/jetbrains_logo.png" height="50" alt="JetBrains logo" />](https://www.jetbrains.com)
package/bin/cfg.d.ts ADDED
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Configure polars; offers options for table formatting and more.
3
+ */
4
+ export interface Config {
5
+ /** Use ASCII characters to display table outlines.
6
+ * @param active - Set False to revert to the standard UTF8_FULL_CONDENSED formatting style. Default: true
7
+ *
8
+ * @example
9
+ * const df = pl.DataFrame({abc: [1.0, 2.5, 5.0], xyz: [true, false, true]})
10
+ pl.Config.setAsciiTables(true)
11
+
12
+ # shape: (3, 2) shape: (3, 2)
13
+ # ┌─────┬───────┐ +-----+-------+
14
+ # │ abc ┆ xyz │ | abc | xyz |
15
+ # │ --- ┆ --- │ | --- | --- |
16
+ # │ f64 ┆ bool │ | f64 | bool |
17
+ # ╞═════╪═══════╡ +=============+
18
+ # │ 1.0 ┆ true │ >> | 1.0 | true |
19
+ # │ 2.5 ┆ false │ | 2.5 | false |
20
+ # │ 5.0 ┆ true │ | 5.0 | true |
21
+ # └─────┴───────┘ +-----+-------+
22
+ */
23
+ setAsciiTables(active: boolean): Config;
24
+ setAsciiTables(): Config;
25
+ /** Set the maximum width of a table in characters.
26
+ * @param width - Maximum table width in characters; if n < 0 (eg: -1), display full width.
27
+ *
28
+ * @example
29
+ * const df = pl.DataFrame({ id: ["SEQ1", "SEQ2"], seq: ["ATGATAAAGGAG", "GCAACGCATATA"] });
30
+ >>> df
31
+ shape: (2, 2)
32
+ ┌──────┬──────────────┐
33
+ │ id ┆ seq │
34
+ │ --- ┆ --- │
35
+ │ str ┆ str │
36
+ ╞══════╪══════════════╡
37
+ │ SEQ1 ┆ ATGATAAAGGAG │
38
+ │ SEQ2 ┆ GCAACGCATATA │
39
+ └──────┴──────────────┘
40
+ >>> pl.Config.setTblWidthChars(12);
41
+ >>> df
42
+ shape: (2, 2)
43
+ ┌─────┬─────┐
44
+ │ id ┆ seq │
45
+ │ --- ┆ --- │
46
+ │ str ┆ str │
47
+ ╞═════╪═════╡
48
+ │ SEQ ┆ ATG │
49
+ │ 1 ┆ ATA │
50
+ │ ┆ AAG │
51
+ │ ┆ GAG │
52
+ │ SEQ ┆ GCA │
53
+ │ 2 ┆ ACG │
54
+ │ ┆ CAT │
55
+ │ ┆ ATA │
56
+ └─────┴─────┘
57
+ */
58
+ setTblWidthChars(width: number): Config;
59
+ setTblWidthChars(): Config;
60
+ /** Set the max number of rows used to draw the table (both Dataframe and Series).
61
+ * @param n - Number of rows to display; if `n < 0` (eg: -1), display all rows (DataFrame) and all elements (Series).
62
+ *
63
+ * @example
64
+ const df = pl.DataFrame({abc: [1.0, 2.5, 5.0], xyz: [true, false, true]})
65
+ pl.Config.setTblRows(2);
66
+
67
+ shape: (4, 2)
68
+ ┌─────┬───────┐
69
+ │ abc ┆ xyz │
70
+ │ --- ┆ --- │
71
+ │ f64 ┆ bool │
72
+ ╞═════╪═══════╡
73
+ │ 1.0 ┆ true │
74
+ │ … ┆ … │
75
+ │ 5.0 ┆ false │
76
+ └─────┴───────┘
77
+ */
78
+ setTblRows(n: number): Config;
79
+ setTblRows(): Config;
80
+ /** Set the number of columns that are visible when displaying tables.
81
+ * @param n - Number of columns to display; if `n < 0` (eg: -1), display all columns.
82
+ *
83
+ * @example
84
+
85
+ const df = pl.DataFrame( {abc: [1.0, 2.5, 3.5, 5.0], def: ["d", "e", "f", "g"], xyz: [true, false, true, false] } );
86
+ // Set number of displayed columns to a low value
87
+ pl.Config.setTblCols(2);
88
+
89
+ shape: (4, 3)
90
+ ┌─────┬───┬───────┐
91
+ │ abc ┆ … ┆ xyz │
92
+ │ --- ┆ ┆ --- │
93
+ │ f64 ┆ ┆ bool │
94
+ ╞═════╪═══╪═══════╡
95
+ │ 1.0 ┆ … ┆ true │
96
+ │ 2.5 ┆ … ┆ false │
97
+ │ 3.5 ┆ … ┆ true │
98
+ │ 5.0 ┆ … ┆ false │
99
+ └─────┴───┴───────┘
100
+ */
101
+ setTblCols(n?: number): Config;
102
+ /**
103
+ * Display the data type next to the column name (to the right, in parentheses).
104
+ * @param active - true / false Default - true
105
+ *
106
+ * @example
107
+ --------
108
+ const df = pl.DataFrame({abc: [1.0, 2.5, 5.0], xyz: [true, false, true]})
109
+ pl.Config.setTblColumnDataTypeInline(true)
110
+
111
+ # shape: (3, 2) shape: (3, 2)
112
+ # ┌─────┬───────┐ ┌───────────┬────────────┐
113
+ # │ abc ┆ xyz │ │ abc (f64) ┆ xyz (bool) │
114
+ # │ --- ┆ --- │ ╞═══════════╪════════════╡
115
+ # │ f64 ┆ bool │ │ 1.0 ┆ true │
116
+ # ╞═════╪═══════╡ >> │ 2.5 ┆ false │
117
+ # │ 1.0 ┆ true │ │ 5.0 ┆ true │
118
+ # │ 2.5 ┆ false │ └───────────┴────────────┘
119
+ # │ 5.0 ┆ true │
120
+ # └─────┴───────┘
121
+ */
122
+ setTblColumnDataTypeInline(active?: boolean): Config;
123
+ /**
124
+ * Hide table column data types (i64, f64, str etc.).
125
+ * @param active - true / false Default - true
126
+
127
+ * @example
128
+ const df = pl.DataFrame({abc: [1.0, 2.5, 5.0], xyz: [true, false, true]})
129
+ pl.Config.setTblHideColumnDataTypes(true)
130
+
131
+ # shape: (3, 2) shape: (3, 2)
132
+ # ┌─────┬───────┐ ┌─────┬───────┐
133
+ # │ abc ┆ xyz │ │ abc ┆ xyz │
134
+ # │ --- ┆ --- │ ╞═════╪═══════╡
135
+ # │ f64 ┆ bool │ │ 1.0 ┆ true │
136
+ # ╞═════╪═══════╡ >> │ 2.5 ┆ false │
137
+ # │ 1.0 ┆ true │ │ 5.0 ┆ true │
138
+ # │ 2.5 ┆ false │ └─────┴───────┘
139
+ # │ 5.0 ┆ true │
140
+ # └─────┴───────┘
141
+ */
142
+ setTblHideColumnDataTypes(active?: boolean): Config;
143
+ /**
144
+ * Enable additional verbose/debug logging.
145
+ * @param active - true / false Default - true
146
+ */
147
+ setVerbose(active?: boolean): Config;
148
+ /**
149
+ * Set the thousands grouping separator character.
150
+ * @param separator : string | bool
151
+ Set True to use the default "," (thousands) and "." (decimal) separators.
152
+ Can also set a custom char, or set ``None`` to omit the separator.
153
+ */
154
+ setThousandsSeparator(separator?: string | boolean): Config;
155
+ }
156
+ export declare const Config: Config;
package/bin/cfg.js ADDED
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Config = void 0;
7
+ const polars_internal_1 = __importDefault(require("./internals/polars_internal"));
8
+ exports.Config = {
9
+ setAsciiTables(active) {
10
+ polars_internal_1.default.setAsciiTables(active);
11
+ return this;
12
+ },
13
+ setTblWidthChars(width) {
14
+ polars_internal_1.default.setTblWidthChars(width);
15
+ return this;
16
+ },
17
+ setTblRows(n) {
18
+ polars_internal_1.default.setTblRows(n);
19
+ return this;
20
+ },
21
+ setTblCols(n) {
22
+ polars_internal_1.default.setTblCols(n);
23
+ return this;
24
+ },
25
+ setTblColumnDataTypeInline(active) {
26
+ polars_internal_1.default.setTblColumnDataTypeInline(active ? 1 : 0);
27
+ return this;
28
+ },
29
+ setTblHideColumnDataTypes(active) {
30
+ polars_internal_1.default.setTblHideColumnDataTypes(active ? 1 : 0);
31
+ return this;
32
+ },
33
+ setVerbose(active) {
34
+ polars_internal_1.default.setVerbose(active ? 1 : 0);
35
+ return this;
36
+ },
37
+ setThousandsSeparator(separator) {
38
+ if (typeof separator === "boolean" && separator) {
39
+ polars_internal_1.default.setDecimalSeparator(".");
40
+ polars_internal_1.default.setThousandsSeparator(",");
41
+ }
42
+ else if (typeof separator === "string") {
43
+ if (separator.length > 1)
44
+ throw new TypeError("separator must be a single character;");
45
+ polars_internal_1.default.setThousandsSeparator(separator);
46
+ }
47
+ else {
48
+ polars_internal_1.default.setThousandsSeparator();
49
+ }
50
+ return this;
51
+ },
52
+ };