1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.partition = exports.merge = exports.branch = exports.empty = void 0;
|
11 | const exception_1 = require("../exception/exception");
|
12 | const host_tree_1 = require("./host-tree");
|
13 | const interface_1 = require("./interface");
|
14 | function empty() {
|
15 | return new host_tree_1.HostTree();
|
16 | }
|
17 | exports.empty = empty;
|
18 | function branch(tree) {
|
19 | return tree.branch();
|
20 | }
|
21 | exports.branch = branch;
|
22 | function merge(tree, other, strategy = interface_1.MergeStrategy.Default) {
|
23 | tree.merge(other, strategy);
|
24 | return tree;
|
25 | }
|
26 | exports.merge = merge;
|
27 | function partition(tree, predicate) {
|
28 | if (tree instanceof host_tree_1.HostTree) {
|
29 | return [
|
30 | new host_tree_1.FilterHostTree(tree, predicate),
|
31 | new host_tree_1.FilterHostTree(tree, (path, entry) => !predicate(path, entry)),
|
32 | ];
|
33 | }
|
34 | else {
|
35 | throw new exception_1.SchematicsException('Tree type is not supported.');
|
36 | }
|
37 | }
|
38 | exports.partition = partition;
|