function collectASequenceOfBytes (condition, input, position) {
  let start = position.position

  while (start < input.length && condition(input[start])) {
    ++start
  }

  return input.subarray(position.position, (position.position = start))
}
@param {(char: number) => boolean} condition
@param {Buffer} input
@param {{ position: number }} position