index.js
function patch(config, nodes, offset) {
  var position = config.location.toPosition
  var length = nodes.length
  var index = -1
  var start = offset
  var children
  var node
  var end

  while (++index < length) {
    node = nodes[index]
    children = node.children

    if (children) {
      patch(config, children, start)
    }

    end = start + toString(node).length

    node.position = {start: position(start), end: position(end)}

    start = end
  }

  return nodes
}
function patch(config, nodes, offset) {
  var position = config.location.toPosition
  var length = nodes.length
  var index = -1
  var start = offset
  var children
  var node
  var end

  while (++index < length) {
    node = nodes[index]
    children = node.children

    if (children) {
      patch(config, children, start)
    }

    end = start + toString(node).length

    node.position = {start: position(start), end: position(end)}

    start = end
  }

  return nodes
}
function patch ( config , nodes , offset ) { var position = config . location . toPosition var length = nodes . length var index = - 1 var start = offset var children var node var end while ( ++ index < length ) { node = nodes [ index ] children = node . children if ( children ) { patch ( config , children , start ) } end = start + toString ( node ) . length node . position = { start : position ( start ) , end : position ( end ) } start = end } return nodes }
Patch a position on each node in `nodes`. `offset` is the offset in `file` this run of content starts at.
Patch a position on each node in nodes . offset is the offset in file this run of content starts at .