<commit_before>/* global internalScope */

(function () {
  var isNumeric = internalScope.isNumeric;

  function offsetAnchorParse (input) {
    if (input === 'auto') {
      return input;
    }

    var values = input.split(/\s+/);
    if (values.length !== 2) {
      // if the input is not auto, there must be 2 percentages
      return undefined;
    }

    for (var i = 0; i < values.length; i++) {
      if (!values[i].endsWith('%')) {
        // value must be a percentage
        return undefined;
      }
      var percentage = values[i].substring(0, values[i].length - 1);
      if (!(isNumeric(percentage)) || percentage.length === 0) {
        // precentage must be a number
        return undefined;
      }
      values[i] = Number(percentage);
    }

    return values;
  }
<commit_msg>added link to spec and a TODO<commit_after>/* global internalScope */

(function () {
  /* spec for the offset-anchor property:
     https://drafts.fxtf.org/motion-1/#offset-anchor-property
  */
  var isNumeric = internalScope.isNumeric;

  function offsetAnchorParse (input) {
    // TODO: add support for the full range of <position> values in the grammar.
    if (input === 'auto') {
      return input;
    }

    var values = input.split(/\s+/);
    if (values.length !== 2) {
      // if the input is not auto, there must be 2 percentages
      return undefined;
    }

    for (var i = 0; i < values.length; i++) {
      if (!values[i].endsWith('%')) {
        // value must be a percentage
        return undefined;
      }
      var percentage = values[i].substring(0, values[i].length - 1);
      if (!(isNumeric(percentage)) || percentage.length === 0) {
        // precentage must be a number
        return undefined;
      }
      values[i] = Number(percentage);
    }

    return values;
  }

{'fraction_non_alphanumeric': 0.1377212389380531, 'fraction_numerical': 0.007190265486725664, 'mean_word_length': 2.27124773960217, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 1, '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': '3471427', 'n_tokens_mistral': 563, 'n_tokens_neox': 538, 'n_words': 165}