Check if token is part of a condition
(e.g. `@if ...`, `@else if ...` or `@else ...`).
@param {number} i Token's index number
@return {number} Length of the condition
166522
function checkCondition(i) {
  const start = i;
  let l;
  let _i;
  let s;

  if (i >= tokensLength) return 0;

  if (l = checkAtkeyword(i)) i += l;
  else return 0;

  if (['if', 'else'].indexOf(tokens[start + 1].value) < 0) return 0;

  while (i < tokensLength) {
    if (l = checkBlock(i)) break;

    s = checkSC(i);
    _i = i + s;

    if (l = _checkCondition(_i)) i += l + s;
    else break;
  }

  return i - start;
}
178215
function checkCombinator3(i) {
  const type = tokens[i].type;
  if (type === TokenType.PlusSign ||
      type === TokenType.GreaterThanSign ||
      type === TokenType.Tilde) return 1;
  else return 0;
}
884814
function isChecked(token) {
    var checked = false;

    if (token.content.indexOf('[x]') === 0 || token.content.indexOf('[X]') === 0) {
        checked = true;
    }

    return checked;
}
569071
function checkFunctionsList(i) {
  let d = 0; // Number of dots
  let l;

  if (i >= tokensLength) return 0;

  if (l = checkFunction(i)) i += l;
  else return 0;

  while (i < tokensLength && tokens[i].type === TokenType.FullStop) {
    d++;
    i++;
  }

  return d === 3 ? l + d : 0;
}
844108
function checkShash(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  if (tokens[i].type === TokenType.NumberSign) i++;
  else return 0;

  if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;
  else return 0;

  while (i < tokensLength) {
    if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;
    else break;
  }

  tokens[start].shashEnd = i;

  return i - start;
}
249253
function(a) {
                    for(var i=0; i<a.length; i++)
                        if(!a[i].equals(0)) return i;
                }
531099
function checkCombinator2(i) {
  if (i + 1 >= tokensLength) return 0;

  if (tokens[i].type === TokenType.VerticalLine &&
      tokens[i + 1].type === TokenType.VerticalLine) return 2;

  if (tokens[i].type === TokenType.GreaterThanSign &&
      tokens[i + 1].type === TokenType.GreaterThanSign) return 2;

  return 0;
}
917487
function checkAtkeyword(i) {
  let l;

  // Check that token is `@`:
  if (i >= tokensLength ||
      tokens[i++].type !== TokenType.CommercialAt) return 0;

  return (l = checkIdentOrInterpolation(i)) ? l + 1 : 0;
}
231607
function checkInclude6(i) {
  const start = i;
  let l;

  if (tokens[i].type === TokenType.PlusSign) i++;
  else return 0;

  if (l = checkIdentOrInterpolation(i)) i += l;
  else return 0;

  if (l = checkSC(i)) i += l;

  if (l = checkArguments(i)) i += l;
  else return 0;

  return i - start;
}
72855
function checkShash(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  if (tokens[i].type === TokenType.NumberSign) i++;
  else return 0;

  if (l = checkIdent(i)) i += l;
  else return 0;

  return i - start;
}
288870
function checkVariable(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  // Skip `$`.
  if (tokens[i].type === TokenType.DollarSign) i++;
  else return 0;

  if (l = checkIdent(i)) i += l;
  else return 0;

  return i - start;
}
774015
function checkBlock(i) {
  return i < tokensLength && tokens[i].block_end ?
      tokens[i].block_end - i + 1 : 0;
}
1357620
function getTokensLength(tokens) {
  if (typeof tokens === 'string') {
    return tokens.length;
  }
  return tokens.reduce((acc, token) => {
    return acc + (token.length ? token.length : 0);
  }, 0);
}
1037987
function checkSelector1(i) {
  if (i >= tokensLength) return 0;

  const start = i;
  let l;

  if (l = checkCompoundSelector(i)) i += l;
  else return 0;

  while (i < tokensLength) {
    let space = checkSC(i);
    const comma = checkCombinator(i + space);
    if (!space && !comma) break;

    if (comma) {
      i += space + comma;
      space = checkSC(i);
    }

    if (l = checkCompoundSelector(i + space)) i += space + l;
    else break;
  }

  tokens[start].selectorEnd = i;
  return i - start;
}
404949
function isIndex(value, length) {
  var type = typeof value;
  length = length == null ? MAX_SAFE_INTEGER$1 : length;

  return !!length &&
    (type == 'number' ||
      (type != 'symbol' && reIsUint.test(value))) &&
        (value > -1 && value % 1 == 0 && value < length);
}
846688
function checkParentSelectorExtension(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  while (i < tokensLength) {
    if (l = checkIdentOrInterpolation(i) || checkPartialIdent(i)) i += l;
    else break;
  }

  return i - start;
}
21303
function checkUnicodeRange(i) {
  const start = i;
  let l;

  if (i >= tokensLength) return 0;

  if (l = checkUrange(i)) i += l;
  else return 0;

  while (i < tokensLength) {
    const spaceBefore = checkSC(i);
    const comma = checkDelim(i + spaceBefore);
    if (!comma) break;

    const spaceAfter = checkSC(i + spaceBefore + comma);
    if (l = checkUrange(i + spaceBefore + comma + spaceAfter)) {
      i += spaceBefore + comma + spaceAfter + l;
    } else break;
  }

  return i - start;
}