getInBracketsRight function

Option<String> getInBracketsRight(
  1. String input,
  2. BracketType bracketType
)

Finds the brackets furthest to the right '(L) (R)' inp: bl(blim) (plumpy(stumpy)) out: (plumpy(stumpy))

Implementation

Option<String> getInBracketsRight(String input, BracketType bracketType) {
  return bracketPositionRight(input, bracketType).bind((x) => some(input.substring(x.start - 1, x.end + 1)));
}