<commit_before>/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 */

import { HTMLElement } from '@ephox/dom-globals';
import { Arr, Fun, Option, Options } from '@ephox/katamari';
import { CaretPosition } from './CaretPosition';
import { HDirection, CaretWalker } from './CaretWalker';
import CaretFinder from './CaretFinder';
import NodeType from '../dom/NodeType';
import { isInSameBlock } from './CaretUtils';

export enum BreakType {
  Br,
  Block,
  Wrap,
  Eol
}

export interface LineInfo {
  positions: CaretPosition[];
  breakType: BreakType;
  breakAt: Option<CaretPosition>;
}

type CheckerPredicate = typeof CaretPosition.isAbove | typeof CaretPosition.isBelow;
type LineInfoFinder = (scope: HTMLElement, start: CaretPosition) => LineInfo;
type CaretPositionsFinder = (scope: HTMLElement, start: CaretPosition) => CaretPosition[];

const flip = (direction: HDirection, positions: CaretPosition[]) => direction === HDirection.Backwards ? positions.reverse() : positions;
<commit_msg>Use Arr.reverse instead of Array.prototype.reverse<commit_after>/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 */

import { HTMLElement } from '@ephox/dom-globals';
import { Arr, Fun, Option, Options } from '@ephox/katamari';
import { CaretPosition } from './CaretPosition';
import { HDirection, CaretWalker } from './CaretWalker';
import CaretFinder from './CaretFinder';
import NodeType from '../dom/NodeType';
import { isInSameBlock } from './CaretUtils';

export enum BreakType {
  Br,
  Block,
  Wrap,
  Eol
}

export interface LineInfo {
  positions: CaretPosition[];
  breakType: BreakType;
  breakAt: Option<CaretPosition>;
}

type CheckerPredicate = typeof CaretPosition.isAbove | typeof CaretPosition.isBelow;
type LineInfoFinder = (scope: HTMLElement, start: CaretPosition) => LineInfo;
type CaretPositionsFinder = (scope: HTMLElement, start: CaretPosition) => CaretPosition[];

const flip = (direction: HDirection, positions: CaretPosition[]): CaretPosition[] =>
  direction === HDirection.Backwards ? Arr.reverse(positions) : positions;

{'fraction_non_alphanumeric': 0.11716509627201967, 'fraction_numerical': 0.0, 'mean_word_length': 5.05955334987593, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2363487', 'n_tokens_mistral': 715, 'n_tokens_neox': 725, 'n_words': 227}