<commit_before>var newBlock = require('./new-block.js');

function getColorValue(string) {
  var color = string.split('rgb(')[1];
  color = color.split(')')[0];
  return color;
}

function unitsMatch() {
  var args = Array.prototype.slice.call(arguments, 0);
  var re = /(px|%|em|rem|vh|vw)$/gi;
  var extension = args[0].match(re).toString();

  for(var i = 1; i < args.length; i++) {
    if(args[i].match(re).toString() !== extension) {
      return false;
    }
  }
  return true;
}

module.exports = function lostUtilityDecl(css) {
  css.walkDecls('lost-utility', function lostUtilityDeclFunction(decl) {
    var utilityArray = decl.value.split(' ');
    var utility = utilityArray[0];
    var color;

    if (utility === 'edit') {
      if (utilityArray[1]) {
        color = getColorValue(decl.value);

        newBlock(
          decl,
          ' *:not(input):not(textarea):not(select)',
          ['background-color'],
          ['rgba(' + color + ', 0.1)']
        );
      } else {
        newBlock(
          decl,
          ' *:not(input):not(textarea):not(select)',
          ['background-color'],
          ['rgba(0, 0, 255, 0.1)']
        );
      }
    }

    if (utility === 'clearfix') {
      newBlock(
        decl,
        ':after',
        ['content', 'display', 'clear'],
        ['\'\'', 'table', 'both']
      );

      newBlock(
        decl,
        ':before',
        ['content', 'display'],
        ['\'\'', 'table']
      );
    }

    if (utility === 'overlay') {
      var maxWidth = utilityArray[1] || '1024px',
        numCols = utilityArray[2] || 12,
        gutter = utilityArray[3] || '20px',
        totalGutter = parseFloat(gutter) * (numCols - 1),
        colWidth = (((parseFloat(maxWidth) - totalGutter) / numCols) / parseFloat(maxWidth)) * 100,
        gutterPercentage = parseFloat(gutter) / parseFloat(maxWidth) * 100,
        position = 0,
        gradient = 'to right, ';

        color = utilityArray[4] || '#e6f6ff';

      if(!unitsMatch(maxWidth, gutter)) {
        throw decl.error('lost-utility: Please use the same units for width and gutter.', { plugin: 'lost', word: 'lost-utility' });
      }
        
      for(var i = 1; i < numCols; i++) {
        // Start of color column
        gradient = gradient + color + ' ' + position + '%, ';

        // Move position to end of color column
        position = position + colWidth;

        // End of color column + Start of gutter column
        gradient = gradient + color + ' ' + position + '%, transparent ' + position + '%, ';

        // Move position to end of gutter column
        position = position + gutterPercentage;

        // End of gutter column
        gradient = gradient + 'transparent ' + position + '%, ';
      }

      gradient = gradient + color + ' ' + position + '%, ' + color + ' 100%';
      <commit_msg>Updates incorrect spacing introduced in last commit.<commit_after>var newBlock = require('./new-block.js');

function getColorValue(string) {
  var color = string.split('rgb(')[1];
  color = color.split(')')[0];
  return color;
}

function unitsMatch() {
  var args = Array.prototype.slice.call(arguments, 0);
  var re = /(px|%|em|rem|vh|vw)$/gi;
  var extension = args[0].match(re).toString();

  for(var i = 1; i < args.length; i++) {
    if(args[i].match(re).toString() !== extension) {
      return false;
    }
  }
  return true;
}

module.exports = function lostUtilityDecl(css) {
  css.walkDecls('lost-utility', function lostUtilityDeclFunction(decl) {
    var utilityArray = decl.value.split(' ');
    var utility = utilityArray[0];
    var color;

    if (utility === 'edit') {
      if (utilityArray[1]) {
        color = getColorValue(decl.value);

        newBlock(
          decl,
          ' *:not(input):not(textarea):not(select)',
          ['background-color'],
          ['rgba(' + color + ', 0.1)']
        );
      } else {
        newBlock(
          decl,
          ' *:not(input):not(textarea):not(select)',
          ['background-color'],
          ['rgba(0, 0, 255, 0.1)']
        );
      }
    }

    if (utility === 'clearfix') {
      newBlock(
        decl,
        ':after',
        ['content', 'display', 'clear'],
        ['\'\'', 'table', 'both']
      );

      newBlock(
        decl,
        ':before',
        ['content', 'display'],
        ['\'\'', 'table']
      );
    }

    if (utility === 'overlay') {
      var maxWidth = utilityArray[1] || '1024px',
        numCols = utilityArray[2] || 12,
        gutter = utilityArray[3] || '20px',
        totalGutter = parseFloat(gutter) * (numCols - 1),
        colWidth = (((parseFloat(maxWidth) - totalGutter) / numCols) / parseFloat(maxWidth)) * 100,
        gutterPercentage = parseFloat(gutter) / parseFloat(maxWidth) * 100,
        position = 0,
        gradient = 'to right, ';

      color = utilityArray[4] || '#e6f6ff';

      if(!unitsMatch(maxWidth, gutter)) {
        throw decl.error('lost-utility: Please use the same units for width and gutter.', { plugin: 'lost', word: 'lost-utility' });
      }
        
      for(var i = 1; i < numCols; i++) {
        // Start of color column
        gradient = gradient + color + ' ' + position + '%, ';

        // Move position to end of color column
        position = position + colWidth;

        // End of color column + Start of gutter column
        gradient = gradient + color + ' ' + position + '%, transparent ' + position + '%, ';

        // Move position to end of gutter column
        position = position + gutterPercentage;

        // End of gutter column
        gradient = gradient + 'transparent ' + position + '%, ';
      }

      gradient = gradient + color + ' ' + position + '%, ' + color + ' 100%';
      
{'fraction_non_alphanumeric': 0.1676300578034682, 'fraction_numerical': 0.014713610089332634, 'mean_word_length': 2.189944134078212, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2838502', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1765, 'n_words': 414}