1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | function columnChildren(_ref) {
|
7 | var columns = _ref.columns,
|
8 | _ref$childrenField = _ref.childrenField,
|
9 | childrenField = _ref$childrenField === undefined ? 'children' : _ref$childrenField;
|
10 |
|
11 | if (!columns) {
|
12 | throw new Error('resolve.columnChildren - Missing columns!');
|
13 | }
|
14 |
|
15 | var ret = [];
|
16 |
|
17 | columns.forEach(function (column) {
|
18 |
|
19 | if (column[childrenField] && column[childrenField].length) {
|
20 | ret = ret.concat(columnChildren({
|
21 | columns: column[childrenField],
|
22 | childrenField: childrenField
|
23 | }));
|
24 | } else {
|
25 | ret.push(column);
|
26 | }
|
27 | });
|
28 |
|
29 | return ret;
|
30 | }
|
31 |
|
32 | exports.default = columnChildren; |
\ | No newline at end of file |