Branch links - adamjgrant/permutations GitHub Wiki

To converge two points back together at a common branching point, branch references can be used.

{
  "main": [
    "Hello", "Hi", "Greetings", [
      ", ", [
        "How are you?", "How's it going?", [
          " ", [
            "I just wanted to ", [
              "take the time to tell you", "remind you", [
                " to ", { "branch": "advice" }
              ]
            ]
          ]
        ]
      ],
      [
        { "branch": "advice"}
      ]
    ]
  ],
  "advice": [
    "Please remember", "Take caution", [
      " to ", [
        "mind the gap", "stay six feet apart", "clean up your area", [
          " ", [
            "at all times.", "to be a good citizen."
          ]
        ]
      ]
    ]
  ]
}

To use a branch link, simply create a root-level key for your new branch

{
  "main": [],
  "advice": []
}

And link to it from any part of an array.

{
  "main": ["a", { "branch": "advice" } ],
  "advice": ["b"]
}