src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/nodeReader.ts/lastOrUndefined
function lastOrUndefined<T>(arr: readonly T[]): T | undefined {
	return arr.length > 0 ? arr[arr.length - 1] : undefined;
}