<commit_before>define(
  'ephox.sugar.api.selection.Edge',

  [
    'ephox.sugar.api.dom.Compare',
    'ephox.sugar.api.selection.Awareness',
    'ephox.sugar.api.selection.CursorPosition'
  ],

  function (Compare, Awareness, CursorPosition) {
    var isAtEdge = function (parent, current, currentOffset, descent, awareness) {
      return descent(parent).fold(function () {
        return true;
      }, function (element) {
        return Compare.eq(current, element) && awareness(current, currentOffset);
      });
    };

    var isLeft = function (parent, selection) {
      return isAtEdge(parent, selection.startContainer(), selection.startOffset(), CursorPosition.first, Awareness.isStart);
    };

    // This is doing exactly the same thing as the above isLeft method, checking to see if an element/offset selection endpoint is at the left edge of it's parent
    // after ascending up to that parent except we explicitly provide the element and it's offset instead of just using the selection object.
    var isAtLeftEdge = function (parent, element, offset) {
      return isAtEdge(parent, element, offset, CursorPosition.first, Awareness.isStart);
    };

    var isRight = function (parent, selection) {
      return isAtEdge(parent, selection.startContainer(), selection.startOffset(), CursorPosition.last, Awareness.isEnd);
    };

    // This is doing exactly the same thing as the above isRight method, checking to see if an element/offset selection endpoint is at the right edge of its parent
    // after ascending up to that parent except we explicitly provide the element and its offset instead of just using the selection object.
    var isAtRightEdge = function (parent, element, offset) {
      return isAtEdge(parent, element, offset, CursorPosition.last, Awareness.isEnd);
    };

    return {
      isLeft: isLeft,
      isAtLeftEdge: isAtLeftEdge,
      isRight: isRight,
      isAtRightEdge: isAtRightEdge
    };
  }
);<commit_msg>TM-3: typo<commit_after>define(
  'ephox.sugar.api.selection.Edge',

  [
    'ephox.sugar.api.dom.Compare',
    'ephox.sugar.api.selection.Awareness',
    'ephox.sugar.api.selection.CursorPosition'
  ],

  function (Compare, Awareness, CursorPosition) {
    var isAtEdge = function (parent, current, currentOffset, descent, awareness) {
      return descent(parent).fold(function () {
        return true;
      }, function (element) {
        return Compare.eq(current, element) && awareness(current, currentOffset);
      });
    };

    var isLeft = function (parent, selection) {
      return isAtEdge(parent, selection.startContainer(), selection.startOffset(), CursorPosition.first, Awareness.isStart);
    };

    // This is doing exactly the same thing as the above isLeft method, checking to see if an element/offset selection endpoint is at the left edge of its parent
    // after ascending up to that parent except we explicitly provide the element and its offset instead of just using the selection object.
    var isAtLeftEdge = function (parent, element, offset) {
      return isAtEdge(parent, element, offset, CursorPosition.first, Awareness.isStart);
    };

    var isRight = function (parent, selection) {
      return isAtEdge(parent, selection.startContainer(), selection.startOffset(), CursorPosition.last, Awareness.isEnd);
    };

    // This is doing exactly the same thing as the above isRight method, checking to see if an element/offset selection endpoint is at the right edge of its parent
    // after ascending up to that parent except we explicitly provide the element and its offset instead of just using the selection object.
    var isAtRightEdge = function (parent, element, offset) {
      return isAtEdge(parent, element, offset, CursorPosition.last, Awareness.isEnd);
    };

    return {
      isLeft: isLeft,
      isAtLeftEdge: isAtLeftEdge,
      isRight: isRight,
      isAtRightEdge: isAtRightEdge
    };
  }
);
{'fraction_non_alphanumeric': 0.09288083694820107, 'fraction_numerical': 0.00025516713447307985, 'mean_word_length': 3.531791907514451, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3304825', 'n_tokens_mistral': 1082, 'n_tokens_neox': 1055, 'n_words': 367}