mergeBlocks
mergeBlocks(blockPattern: PatternBlocks<{}>) : PatternBlocks<{}>
mergeBlocks(blockPattern) combines the patterns and sub-patterns in blockPattern
based on common roots. This can be useful if the pattern contains multiple sub-patterns
that each specify part of the desired block properties. For example, consider the following
pattern1:
pattern1 = ```
interface GigabitEthernet1/0/1
switchport mode access
hsrp 30
preempt
router bgp
interface GigabitEthernet1/0/1
description Important port
hsrp 30
priority 50
```;
The value of mergeBlocks(pattern1) will be the following pattern, pattern2, which has all
sub-blocks of the interface combined into one block:
pattern2 = ```
interface GigabitEthernet1/0/1
switchport mode access
hsrp 30
preempt
priority 50
description Important port
router bgp
```;
Note that mergeBlocks(pattern) works at all nesting levels of a block pattern. In other words,
it will merge blocks not just at the root level, but also will apply block merging for the merged
subtrees of a block. This can be seen in the above example, where the multiple hsrp 30 have been
merged together into a single block.