1 | import { Mx } from 'veho';
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | const slice = ({
|
13 | head,
|
14 | rows
|
15 | }) => ({
|
16 | head,
|
17 | rows
|
18 | });
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | const shallow = ({
|
27 | head,
|
28 | rows
|
29 | }) => ({
|
30 | head: head.slice(),
|
31 | rows: rows.map(row => row.slice())
|
32 | });
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 | const clone = ({
|
41 | head,
|
42 | rows
|
43 | }) => ({
|
44 | head: head.slice(),
|
45 | rows: Mx.clone(rows)
|
46 | });
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | const matchSlice = (o = {}) => {
|
59 | var _o$head, _o$rows;
|
60 |
|
61 | const head = (_o$head = o.head) !== null && _o$head !== void 0 ? _o$head : o.banner,
|
62 | rows = (_o$rows = o.rows) !== null && _o$rows !== void 0 ? _o$rows : o.matrix;
|
63 | return {
|
64 | head,
|
65 | rows
|
66 | };
|
67 | };
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | const matchShallow = (o = {}) => {
|
75 | var _o$head2, _o$rows2;
|
76 |
|
77 | const head = (_o$head2 = o.head) !== null && _o$head2 !== void 0 ? _o$head2 : o.banner,
|
78 | rows = (_o$rows2 = o.rows) !== null && _o$rows2 !== void 0 ? _o$rows2 : o.matrix;
|
79 | return {
|
80 | head: head.slice(),
|
81 | rows: rows.map(row => row.slice())
|
82 | };
|
83 | };
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 | const matchClone = (o = {}) => {
|
91 | var _o$head3, _o$rows3;
|
92 |
|
93 | const head = (_o$head3 = o.head) !== null && _o$head3 !== void 0 ? _o$head3 : o.banner,
|
94 | rows = (_o$rows3 = o.rows) !== null && _o$rows3 !== void 0 ? _o$rows3 : o.matrix;
|
95 | return {
|
96 | head: head.slice(),
|
97 | rows: Mx.clone(rows)
|
98 | };
|
99 | };
|
100 |
|
101 | export { clone, matchClone, matchShallow, matchSlice, shallow, slice };
|