1 | import { divide as divide$1 } from '@vect/columns-select';
|
2 | import { divide } from '@vect/vector-select';
|
3 | import { mapper } from '@vect/vector-mapper';
|
4 | import { slice } from '@analys/table-init';
|
5 |
|
6 | const NUM_ASC = (a, b) => a - b;
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | const tableDivide = function (fields) {
|
15 | var _this, _this2;
|
16 |
|
17 |
|
18 | const rs = (_this = this, slice(_this));
|
19 |
|
20 |
|
21 | const pk = (_this2 = this, slice(_this2));
|
22 | const {
|
23 | head,
|
24 | rows
|
25 | } = this;
|
26 | const indexes = mapper(fields, label => head.indexOf(label)).sort(NUM_ASC);
|
27 | ({
|
28 | pick: pk.head,
|
29 | rest: rs.head
|
30 | } = divide(head, indexes));
|
31 | ({
|
32 | pick: pk.rows,
|
33 | rest: rs.rows
|
34 | } = divide$1(rows, indexes));
|
35 | return {
|
36 | pick: pk,
|
37 | rest: rs
|
38 | };
|
39 | };
|
40 |
|
41 | export { tableDivide };
|