index.js
function findPhraseInDirection(node, index, parent, offset) {
  var children = parent.children
  var nodes = []
  var stems = []
  var words = []
  var queue = []
  var child

  while (children[(index += offset)]) {
    child = children[index]

    if (child.type === 'WhiteSpaceNode') {
      queue.push(child)
    } else if (isImportant(child)) {
      nodes = nodes.concat(queue, [child])
      words.push(child)
      stems.push(stemNode(child))
      queue = []
    } else {
      break
    }
  }

  return {
    stems: stems,
    words: words,
    nodes: nodes
  }
}
function findPhraseInDirection(node, index, parent, offset) {
  var children = parent.children
  var nodes = []
  var stems = []
  var words = []
  var queue = []
  var child

  while (children[(index += offset)]) {
    child = children[index]

    if (child.type === 'WhiteSpaceNode') {
      queue.push(child)
    } else if (isImportant(child)) {
      nodes = nodes.concat(queue, [child])
      words.push(child)
      stems.push(stemNode(child))
      queue = []
    } else {
      break
    }
  }

  return {
    stems: stems,
    words: words,
    nodes: nodes
  }
}
function findPhraseInDirection ( node , index , parent , offset ) { var children = parent . children var nodes = [ ] var stems = [ ] var words = [ ] var queue = [ ] var child while ( children [ ( index += offset ) ] ) { child = children [ index ] if ( child . type === 'WhiteSpaceNode' ) { queue . push ( child ) } else if ( isImportant ( child ) ) { nodes = nodes . concat ( queue , [ child ] ) words . push ( child ) stems . push ( stemNode ( child ) ) queue = [ ] } else { break } } return { stems : stems , words : words , nodes : nodes } }
Get following or preceding important words or white space.
Get following or preceding important words or white space .