src/options/space-before-opening-brace.js
function(ast) {
      var detected = [];

      ast.traverseByTypes(['block', 'value'], function(block, i, parent) {
        if (block.is('value') && !block.first().is('block')) return;

        var previousNode = parent.get(i - 1);
        if (!previousNode) return;

        // If it's spaces, modify this node.
        // If it's something different from spaces, add a space node to
        // the end:
        if (previousNode.is('space')) {
          detected.push(previousNode.content);
        } else {
          detected.push('');
        }
      });

      return detected;
    }
function(ast) {
      var detected = [];

      ast.traverseByTypes(['block', 'value'], function(block, i, parent) {
        if (block.is('value') && !block.first().is('block')) return;

        var previousNode = parent.get(i - 1);
        if (!previousNode) return;

        // If it's spaces, modify this node.
        // If it's something different from spaces, add a space node to
        // the end:
        if (previousNode.is('space')) {
          detected.push(previousNode.content);
        } else {
          detected.push('');
        }
      });

      return detected;
    }
Detects the value of an option at the tree node.

@param {node} ast